I have two versions of Java setup for development. One is 1.5 and the other obviously is 1.6.
Now when I type java -version
it displays up 1.6
What should I change so that it points to Java 1.5?
I have two versions of Java setup for development. One is 1.5 and the other obviously is 1.6.
Now when I type java -version
it displays up 1.6
What should I change so that it points to Java 1.5?
On Windows:
1) set your JAVA_HOME environment variable to the 1.5 location, one level above the /bin dir, e.g. C:\myjava5dir, not C:\myjava5dir\bin
2) then set your PATH environment variable to include %JAVA_HOME%\bin
3) be sure to start a new DOS prompt to pick up the changes
Also ensure you clear any other existing references to your jdk in PATH.
On Ubuntu (and similar):
$ update-java-alternatives --list
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
java-6-sun 63 /usr/lib/jvm/java-6-sun
$ update-java-alternatives --set java-1.5.0-sun