How to Install OpenJDK 9 on Ubuntu
Install OpenJDK 9 on Ubuntu
Java is a high level programming language. It is a compiled programming language. But it doesn’ t compile Java code to machine language directly. It compiles to Java byte code using the Java compiler. Then a Java Virtual Machine or JVM is used to translate the Java byte code into machine language. As a computer can only understand machine language, it is the JVM that is responsible for running a Java program. JVM is platform dependent. That is, JVM on Windows is different than JVM on Linux or Mac OS. JVM on Linux is different than JVM on Mac OS or Windows and so on. But the Java byte code is platform independent. So Java can be compiled once and run everywhere. That is why it is so popular and billions of devices have Java installed.
Programmers use Java Development Kit or JDK to compile and run Java programs. JDK is a collection of tools required to develop, debug, package Java applications. It is really so simple to install OpenJDK 9 on Ubuntu and this tutorial covers the ground on the same process.
Installing OpenJDK 9
Before you begin with the process, make sure you update your Ubuntu operating system by making use of the following command.
root@linuxhelp:~# apt-get update
Hit:1 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu xenial InRelease
.
.
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done
And then, you can proceed with the installation of OpenJDK 9 by running the following command.
root@linuxhelp:~# apt-get install openjdk-9-jdk-headless
Reading package lists... Done
.
.
bingwallpaper
Reading package lists... Done
Once OpenJDK 9 is installed, you can verify it, and for that you can check the version of Java compiler provided by the OpenJDK 9 package. Run the following command for the same purpose.
root@linuxhelp:~# javac -version
javac 9-internal
Same way, you can also check Java Virtual Machine (JVM) provided by the OpenJDK 9 package with the help of the following command.
root@linuxhelp:~# java -version
openjdk version " 9-internal"
Also, to check further, create a Hello.java Java source file through the following commands.
root@linuxhelp:/home/user/Documents# cd /home/user/Documents/codes/
root@linuxhelp:/home/user/Documents/codes# vim Hello.java
After that, you need to compile Hello.java file.
root@linuxhelp:/home/user/Documents/codes# javac Hello.java
Also, see the ‘ Hello.class’ Java byte code file.
root@linuxhelp:/home/user/Documents/codes# ls
Hello.class Hello.java
And then run the Java byte code as follows.
root@linuxhelp:/home/user/Documents/codes# java Hello
hello from Linuxhelp
Everything seems to be fine. With this, the installation of OpenJDK 9 on Ubuntu comes to an end.
Comments ( 0 )
No comments available