You’ve probably decided to learn Java as a programming knowledge, or want to test programming Java on the Linux platform. But before your write any code in Java you must fist get you tools together. Aside from a Java text editor or integrated development environment (IDE), and the most important one the Java development kit (JDK). The JDK is essential for developing and testing Java programs.
In this post we would be installing the latest version of the JDK (jdk 8). Lets Go!
STEP 1 – Downloading Java
Get the JDK from Oracle/Sun; download the Java JDK Here.
Please download or move the downloaded file to your home directory, for easy installation.
STEP 2 – Extracting
Run the following in a terminal – note that installing softwares in Linux is a serious matter so there is need to use the “sudo” command to be able to install Java.
(a) Make a “jvm” directory in the libraries folder;
sudo mkdir -p /usr/lib/jvm/
(b) Move the JDK file from your home directory to the “jvm” folder just created;
sudo mv jdk-8u112-linux-i586.tar.gz /usr/lib/jvm/
(c) Change to the “/usr/lib/jvm” directory;
(d) You should now be in the “/usr/lib/jvm” directory, then extract the java JDK package archive.
sudo tar zxvf jdk-8u112-linux-i586.tar.gz
STEP 3 – Installing and testing Java
Now enable Java (by running individually):
sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/oracle_jdk8/bin/java” 1
user@host:~$ sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/oracle_jdk8/bin/javac” 1
user@host:~$ sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/oracle_jdk8/bin/javaws” 1
Java is now installed! To test that the installation was successful, type this at the command terminal;
You should get this output:
java version “1.8.0_112“
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) Server VM (build 25.112-b15, mixed mode)
Any observation or comment(s) please let us know in the comment section below.