Question

This may be common in web but may be I am not getting what to search exactly. Actually I am having different versions of java on my ubuntu server having java 1.5 as default. One of my program need java 1.6 and even if I perform following in the shell script executing that program
export JAVA_HOME=/path/to/jdk6
I dont get any success.What I learnt is I could see current java version using
java -version
This only get change when I changes the alternative using:
sudo update-alternatives --config java

Please tell me how can I change it in the shell script which in turn calls the java program requiring java6 having java 5 as default only.

Thanks!!!

Was it helpful?

Solution

You need to update the PATH as well:

JAVA_HOME=/path/to/jdk6
export JAVA_HOME
PATH=${JAVA_HOME}/bin:${PATH}
export PATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top