How to install Oracle Java JDK on Ubuntu Linux

Table of contents:

How to install Oracle Java JDK on Ubuntu Linux
How to install Oracle Java JDK on Ubuntu Linux
Anonim

You will be able to install the JDK or the Java version 9 development environment on Linux Ubuntu as well as most distributions derived from Debian, such as Linux Mint. Note that since March 2018, only the 64-bit version of Java 9 can be implemented in Ubuntu.

Steps

Install Oracle Java JDK on Ubuntu Linux Step 1

Step 1. Open a terminal

Open menu ⋮⋮⋮ and expand it, then click on the icon symbolizing the terminal

Macterminal

You also have the option of simultaneously pressing the shortcut keys Alt + Ctrl + T

Install Oracle Java JDK on Ubuntu Linux Step 2

Step 2. Remove the versions of Java already installed on your system

This is very important, because if you don't, the procedure described here will have no effect:

  • type sudo apt-get purge openjdk - \ *;
  • press the Enter key;
  • if prompted by the system, enter your password;
  • press O if prompted, then press Enter on your keyboard.
Install Oracle Java JDK on Ubuntu Linux Step 3

Step 3. Enter the Java install command

Type sudo apt-get install software-properties-common and press Enter on your keyboard.

Install Oracle Java JDK on Ubuntu Linux Step 4

Step 4. Remove all versions of Java already installed

Type sudo apt autoremove and press Enter, then wait for your old environment to be completely uninstalled from your system. This will have the double advantage of freeing up space on your hard drive and avoiding any risk of interference during the installation of Java.

The uninstallation process may take several minutes

Install Oracle Java JDK on Ubuntu Linux Step 5

Step 5. Update the list of packages to install

Type sudo apt-get update and press Enter to ensure that the list of software packages in the Ubuntu repository on your system is fully updated.

Install Oracle Java JDK on Ubuntu Linux Step 6

Step 6. Navigate to the Oracle software repository

Type sudo add-apt-repository ppa: webupd8team / java in your terminal and press Enter on your keyboard.

Install Oracle Java JDK on Ubuntu Linux Step 7

Step 7. Press the Enter key again when prompted

When you see the message displayed at the bottom of the terminal window Press [ENTER] to continue or Ctrl-c to cancel adding the repository, press the Enter key on your keyboard.

Install Oracle Java JDK on Ubuntu Linux Step 8

Step 8. Download the Java installer

Type sudo apt-get install oracle-java9-installer and press Enter. When prompted, type o then press Enter again. The download of the Java 9 installer will begin. At this point, you will see a confirmation dialog in your terminal.

Install Oracle Java JDK on Ubuntu Linux Step 9

Step 9. Read and accept the software license terms

Press the Enter key once on your keyboard to continue, then use the left arrow key to select Yes and press the Enter key again.

Install Oracle Java JDK on Ubuntu Linux Step 10

Step 10. Wait for the Java download to finish

Be patient, because the process will take about 20 minutes. Wait for the command prompt in your name to reappear in the terminal to continue.

Install Oracle Java JDK on Ubuntu Linux Step 11

Step 11. Set Java 9 as the default version

Type sudo apt-get install oracle-java9-set-default and press Enter on your keyboard, then enter your password if prompted.

Install Oracle Java JDK on Ubuntu Linux Step 12

Step 12. Check the installed version of Java

Type java --version in your terminal and press the Enter key on your keyboard. If everything went as expected, you should see the following text displayed:

  • java version "9, 0.4"

Install Oracle Java JDK on Ubuntu Linux Step 13

Step 13. Update your package lists again

Type sudo apt-get update and press Enter. This will have no effect other than ensuring that the Java package lists as well as those of other software that are installed on your PC will remain up to date. The installation of the Java 9 development environment is now complete and you will be able to exit your terminal when the package list update is complete.

Popular by topic