Reputation: 186
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!!!
Upvotes: 1
Views: 986
Reputation: 123498
You need to update the PATH
as well:
JAVA_HOME=/path/to/jdk6
export JAVA_HOME
PATH=${JAVA_HOME}/bin:${PATH}
export PATH
Upvotes: 1