Open Laboratory for Technocrats

Grab the developer role, learn concepts & prepare with senior software engineers to get solutions for problems in a software job. Coding and Programming Solutions crafted for you.

Ubuntu: How To Set Java Version Default


Ever when we have faced the issue when playing around multiple versions of java for projects and then we need to set the actual java version of project.

I had the same issue, So I figured it out with the simple command for Ubuntu to fix the things.

Steps that I followed are as:

1.  Open Terminal
2.  Run command : sudo update-alternatives --config java
3.  It will give you options like this:

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      manual mode

Press enter to keep the current choice[*], or type selection number:

Now we have to just select the number for the java version to make it default.

#Cheers Enjoy Learning 

Top #3 Articles

Most Read