Wednesday, November 18, 2015

How to install java (JDK/JRE) on Lubuntu


If you want to run java applications (.jar) and also you want to be able to compile java classes then you'll need to have JDK (Java Development Kit) on your computer, so the question is how to install java (JDK) on lubuntu?

To install JDK on lubuntu is very easy, but first let me explain to you something. If what you need is just to run java applications (.jar) and you are not going to develop java applications, then most likely you don't need to install JDK.

If you just want to run java applications, you only need to install JRE (Java Runtime Environment), no need to install JDK, if you already have JDK you don't need to install JRE because JRE already included on JDK.

By the time i wrote this article, there are three different java version available for lubuntu/ubuntu, JDK 6, 7, and 8. Which one should you choose? it depends on your need, the latest one not always a good choice, choose the one that match with your requirements.

How to install open JDK
here's how to install open JDK 6,7, and 8.

Open JDK 6
sudo apt-get install openjdk-6-jdk

Open JDK 7
sudo apt-get install openjdk-7-jdk

Open JDK 8
sudo apt-get install openjdk-8-jdk

How to install JRE
if you only need JRE (Java Runtime Environment) then use this command instead:

JDK 6 runtime environment
sudo apt-get install openjdk-6-jre

JDK 7 runtime environment
sudo apt-get install openjdk-7-jre

JDK 8 runtime environment
sudo apt-get install openjdk-8-jre

Remember, you don't need to install JRE if you already have JDK, for those who install JDK now you can start developing java application, use 'javac' command to compile .java file and then use 'java' command followed by the compiled program to run it.

~ happy coding ~

2 comments: