Thursday 14 June 2012

Change the default Java on Ubuntu


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 JVMs 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 terminal (Ctrl+Alt+T) execute the following commands:


1. Check Current Default Java

java -version
 


 
2. Display Available Java

update-java-alternatives -l

 


3. Select Java from List
 
update-alternatives --config java


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.

No comments:

Post a Comment