Hrnsvnc Blog

Software, Technology and stuff


Easy way to change your java and javac version on Ubuntu / Ubuntu Mate

Picture of terminal with the command to change java version

In this short post i will show you how to easily change your java version and your java compiler version on your Ubuntu / Ubuntu mate 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 our the newest features of the new java version or you have some kind of old project that only works for some old versions (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

You should be getting this message:

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.

Please follow and like us:
Tweet 20

Leave a Reply

Your email address will not be published. Required fields are marked *