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

RStudio for Ubuntu

Step by Step Installation of RStudio Rstudio is an integrated set of tools that can help for statistical computing and graphics....
12/02/2020

Find Package Name of Installed Ubuntu Package

The user can install and uninstall any software in Ubuntu by using Ubuntu Software Center or command line. Many commands...
28/12/2020

10 Best RSS Readers for Ubuntu

Even if most of the tech experts actively claim that RSS (Rich Site Summary) is dead especially after Google Reader was...
28/12/2020
Bài Viết

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

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024