Install Oracle JDK 9 on Ubuntu 17.10

12/02/2020

Install Oracle JDK 9 on Ubuntu 17.10

JDK or Java Development Kit is used to develop Java applications. It is used by Java developers all over the world. There are two implementations of JDK. One is developed by the open source community, which is called OpenJDK. The other one is developed by Oracle, which is called just JDK. The OpenJDK is completely free of charge, and you’re free to do whatever you want with the source code. Basically it’s more open in nature. The JDK provided by Oracle is licensed to Oracle and has some proprietary components. It’s also free, but it’s not as open in nature as OpenJDK.

In this article, I will show you how to install Oracle JDK 9 on Ubuntu 17.10 Artful Aardvark. Let’s get started.


Downloading Oracle JDK 9

Oracle provides a compressed tar file and rpm file of Oracle JDK 9 for Linux. On CentOS/RHEL or any other RPM based Linux distributions, you can easily install Oracle JDK 9 using the rpm package file. But on other distributions such as Ubuntu, Debian, Slackware etc., you should use the compressed tar file. Since I am using Ubuntu 17.10 in this article, I will also use the compressed tar file.

To download Oracle JDK 9, go to https://www.oracle.com from any web browser and click on the “Menu” and then hover over “Downloads and Trials” and then click on “All Downloads and Trials” as shown in the screenshot below:

You should see the following window. Scroll down a little bit and Click on “Java for Developers”.

Then click on “Java Platform (JDK) 9” icon and shown in the screenshot:

You should see the following window. First you have to accept the license agreement. Then you will be able to download Oracle JDK 9 for Linux.

Click on “Accept License Agreement” as shown in the screenshot.

Once you accept the license agreement, click on the file that says “Linux” in the “Product / File Description” and file name ends with tar.gz as shown in the screenshot.

Now save the file. It’s a pretty big file, and may take a while to download.


Installing Oracle JDK 9

Once the download is complete, open a Terminal (Ctrl+Alt+T on Ubuntu) and go to the directory where the file is downloaded with the following command:

$ cd DIRECTORY_PATH_WHERE_YOU_DOWNLOADED_THE_FILE

Now run the following command to extract the file on /opt directory. Note that, /opt is the directory where I am installing Oracle JDK.

$ sudo tar xvzf jdk-9.0.1_linux-x64_bin.tar.gz -C /opt

You can see that the file was extracted on /opt

$ ls /opt

Note the name of the directory which is in my case ‘jdk-9.0.1’

Now we have to add Oracle JDK 9 to our path. To do this, edit /etc/bash.bashrc file with the following command:

$ sudo nano /etc/bash.bashrc

You should see something like this.

At the end of the file, add these two lines and save the file by pressing Ctrl+X and then press ‘y’ and <Enter>.

export JAVA_HOME=/opt/jdk-9.0.1
export PATH=$PATH:${JAVA_HOME}/bin

Now restart your computer with the following command:

$ sudo reboot

Once your computer boots, you can run the following commands to test whether Oracle JDK 9 is in the PATH:

$ whereis java
$ javac -version

You can see that java was found in the correct directory.

The version of java compiler is also 9.

I will just write a simple program and show you that it compiles successfully on JDK 9.

You can see that, the program was compiled and ran correctly.

So, that’s how you install Oracle JDK 9 on Ubuntu 17.10 Artful Aardvark. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install OpenShot on Ubuntu

How to install and use OpenShot Video Editor on Ubuntu 17.04 OpenShot is one of the most popular free video editing software....
28/12/2020

Ubuntu Remote Desktop

Ubuntu Remote Desktop How to Setup an Ubuntu Remote Desktop Accessible From Windows And Android Setting up a remote computer...
12/02/2020

20 Best Ubuntu Applications for 2018

20 Best Ubuntu Applications Recommended for 2018 The popularity and user base of Linux is increasing rapidly hence many...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024