Ubuntu: How do I use Java 6 when java 7 is installed?


How do I use Java 6 when I have both java 6 and java 7 installed? I need both.


To change your default version of Java, you can run

sudo update-alternatives --config java  

A prompt will come up, showing all versions of Java you have installed. Input the list number for the version you want to be the default.

If you want to run one program with a non-default Java version, you need to run the command

/path/to/java-install/java -jar /path/to/program.jar  

This obviously only works with .jar files, so it might be best to have two scripts that can switch the default version.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »