How to install Open JDK on Xubuntu


In case you prefer the open source solution for java, then you need to install open JDK on your xubuntu instead of oracle JDK. To install open JDK on xubuntu, no need to add ppa repository, because it already exist on xubuntu/ubuntu default repo.

With open JDK, at least on xubuntu 16.04, you only get two choices of java version that you can install, java version 8 and 9, at the time i wrote this tutorial java 9 is not recommended to install as it contains bugs and still under development.

Step by step how to install Open JDK (i'm using 16.04)
  • run update command (skip if you already did)
  • sudo apt-get update
  • install open JDK 8
  • sudo apt-get install openjdk-8-jdk
  • check the java version make sure it is open JDK that currently active
  • java -version
  • done!

If you previously install oracle JDK, there is no need to uninstall it first, if you decided to use open JDK, you can have two or more JDK on your system, but only one will active and no need to uninstall the previous one. 

But you do need to choose which JDK you wish to use, to switch between open JDK and oracle JDK and vice versa, you can use this command line tool:
sudo update-alternatives --config java
The command above will asked you which JDK will be the default for your java system, so with this command no need to uninstall the previous JDK that you have, you can switch back and forth.

Share this

Related Posts

Previous
Next Post »