Setting up new version of java

Hi,

I have got jre 1.5 that I have got to install in the HP.UX version 11.31.
I managed to install it with this command :

# swinstall -s /tmp/<jre.XXXXX.depot> 

It automatically gets created in /opt/java1.5/jre/bin.
However, now I am not sure how to set the PATH to JAVA_HOME, and path to this /opt/java1.5/jre/bin. Are these two the same?

Also I used this command to try and set the PATH (wrong path) :

export PATH=/opt/java1.5/bin:$PATH

I can now see /opt/java1.5/bin at the beginning of the line when I do an

#echo $PATH

However, since the entry is wrong, how do I remove it?

Also what is the difference between using the command above to set the PATH variable, and also setting it directly in /etc/PATH?

And how do I ensure that I get the output of java version 1.5 when I type this :

java -version

As of now, when I run the command above, it says "java not found".
In other servers on the other hand, I get different java versions when I run the same command.

I would rather use another variable for java such as JAVAPATH or JAVA6PATH etc... as you may need/want different versions even 32/64 bits etc...
setting java ( updating /etc/PATH) is not a good idea unless you have just that version.

Once you export a variable, it cannot be corrected other by giving it a new value...

You can use $JAVAPATH/java -version if you set the variable