How to switch between different Java (JVM) in Ubuntu and Debian GNU Linux
|
|
Sometimes its hard to avoid installing multiple Java Virtual Machines (JVM) on your computer because it has something to do with application compatibility or software development purposes.
This creates an annoyance when you just want to run one of the JVM instead of another for a specific task, then having to switch to another JVM for other tasks.
Here’s an easy way to setup a default JVM (Java interpreter and javac) and switch between several JVM in Ubuntu / Debian based distribution.
From the console execute
sudo update-alternatives --config java
Then you’ll be presented with this menu,

Select the Java distribution which best suits you and press enter. You’re done. You can always change the default JVM for your Ubuntu/Debian distribution by repeating this steps.
[tags]java,jdk,j2sdk,ubuntu,debian,linux,jvm,vm,javac[/tags]
Keep updated with the latest posts, be a part of over 1,000 subscribers! :
Subscribe to your email
You might also want to read...
- Pocket PC may now have Java 1.5.0 supports
- How to install Java Runtime and JDK in Ubuntu Linux
- I’m Officially a Debian GNU/Linux user now!
- Install Java 5 SDK and Java JRE in Ubuntu
- Sun has Open Source Java under GNU/GPL
- Installing Java 2 SDK on Debian GNU/Linux and Ubuntu
- Does anyone here still uses Java Applets?


October 29th, 2007 at 5:45 pm
In fact that would only change the interpreter, not the compiler, creating a symlink from ¿/etc/alternatives/java? to the executable you selected.
For the compiler you’d have to write:
sudo update-alternatives –config javac
October 29th, 2007 at 6:01 pm
yes, true.. thanks for adding the suggestion :)
March 15th, 2008 at 8:14 am
Thank you! I am doing my first programming course and everything is windows orientated. ARGH! I have be having trouble practicing a home because they wanted me to use Textpad etc and it doesn’t seem to work in Wine. Now, I’m on my way! (yes, my program worked!
November 20th, 2008 at 11:21 pm
thank you, this saved me a lot of work :)
December 30th, 2012 at 4:25 pm
Thank you that helped me a lot.
But what is weird that launching the same eclipse version (which I copied from an other HDD) worked when beeing started on the original HDD in my current environment.