How to change your Java and javac version on Ubuntu / Linux

harsvnc profile image Hrn Svncハルン Харун Севиндж ・1 min read

In this short post i will show you how to easily change your java version and your java compiler version on your Ubuntu / Linux machine.

If you have installed more than one version of java on your system, you still have the opportunity to switch between different versions. Maybe you wanted to check out the newest features of the new java version or you have some kind of old project that only works for some older version (yes i know java ist a wora language but anyway).

If that is the case try the following commands:

$ update-alternatives --config java

$ update-alternatives --config javac

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

  Selection    Path                                           Priority   Status
* 0            /usr/lib/jvm/java-11-openjdk-armhf/bin/java    1061      auto mode
  1            /usr/lib/jvm/java-11-openjdk-armhf/bin/java    1044      manual mode
  2            /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java 1061      manual mode

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

After choosing one of the numbers you will be good to go.

Posted on by:

harsvnc profile

Hrn Svncハルン Харун Севиндж


Java and js developer from germany.I do web stuff. I like to try out new stuff und learn new things.


Editor guide