You need to define INSTALL4J_JAVA_HOME environment variable and point it to where your JVM is installed.
If you have sun-java-5 already installed, it should be /usr/lib/jvm/java-1.5.0-sun. Make sure this folder exists or look in /usr/lib/jvm to confirm the folder name.
Set the environment variable from command line with this command
Now run your script file.
If it works, add the above line to ~/.bashrc so the shell reads the variable everytime it is launched.
To set it system-wide, add it to /etc/environment.