Author:
Florence Bailey
Date Of Creation:
27 March 2021
Update Date:
1 July 2024
![How To Install Oracle Java (JDK) On Ubuntu 20.04 LTS, Debian Linux](https://i.ytimg.com/vi/ogWKP9Lm-Qo/hqdefault.jpg)
Content
- Steps
- Method 1 of 3: How to Install Java Without Using a Package Manager (RPM)
- Method 2 of 3: How to Install Java Using a Package Manager (RPM)
- Method 3 of 3: How to Install Java on Ubuntu
- Tips
- Warnings
This article will show you how to install the latest Java Runtime Environment (JRE) on a Linux computer.
Steps
Method 1 of 3: How to Install Java Without Using a Package Manager (RPM)
- 1 Open the download page Java for Linux. Several links to the installation files will be displayed.
- 2 Click on Linux. This link is located in the middle of the page. The Java installation file will be downloaded.
- You can also click Linux X64 if you want to install 64-bit Java.
- 3 Pay attention to the file name. The latest version of Java is version 8, but you will also need the update version that comes after "8u" in the file name.
- For example, if the file is named "jre-8u151", it means that the Java version is 8 and the update version is 151.
- 4 Open a command prompt. Your actions will depend on your Linux version, but usually you will need to open a terminal or click on the bar at the top or bottom of the screen.
- 5 Change the installation directory. In terminal enter cd, put a space and then enter the path (for example: / usr / java /) and press ↵ Enter.
- 6 Enter the command to install. Enter tar zxvf, put a space, and then enter the full file name, which depends on the Java version and the date the file was uploaded.
- If the file was downloaded after October 1, 2017, enter tar zxvf jre-8u151-linux-i586.tar.
- 7 Click on ↵ Enter. Java will be installed in the "jre1.8.0_ [update]" folder, where "[update]" is the update version (for example, 151).
Method 2 of 3: How to Install Java Using a Package Manager (RPM)
- 1 Open the download page Java for Linux. Several links to the installation files will be displayed.
- 2 Click on Linux RPM. This link is located in the middle of the page. This downloads the Java RPM installation file.
- You can also click Linux RPM X64 if you want to install 64-bit Java.
- 3 Pay attention to the file name. The latest version of Java is version 8, but you will also need the update version that comes after "8u" in the file name.
- For example, if the file is named "jre-8u151", it means that the Java version is 8 and the update version is 151.
- 4 Open a command prompt. Your actions will depend on your Linux version, but usually you will need to open a terminal or click on the bar at the top or bottom of the screen.
- 5 Enter the command that will give you superuser rights. Enter sudo su and press ↵ Enter... The system will ask you to enter a password.
- 6 Enter your account password. Enter your account password and click ↵ Enter... If your password is an administrative password, you will be able to install Java.
- If your password is not an administrative one, enter the password for the administrator account.
- 7 Change the installation directory. In terminal enter cd, put a space and then enter the path (e.g .: / usr / java /) and press ↵ Enter.
- 8 Enter the command to install. Enter rpm -ivh, put a space and then enter the full filename and press ↵ Enter... Java will be installed on your computer.
- The file name depends on the date the file was uploaded. If the file was downloaded after October 1, 2017, enter rpm -ivh jre-8u151-linux-i586.rpm and press ↵ Enter.
- 9 Update installed Java. Enter rpm -Uvh jre-8u73-linux-i586.rpm and press ↵ Enter... The system will check for updates to the Java package and, if available, install them.
Method 3 of 3: How to Install Java on Ubuntu
- 1 Open a command prompt. Click on Ctrl+Alt+T on your keyboard or click the black rectangle with white "> _" symbols on the left side of the screen.
- 2 Enter the command to update. Enter sudo apt-get install and press ↵ Enter... This will update the packages on the computer.
- 3 Enter your password if prompted. If the system asks for the superuser password, enter it and press ↵ Enter.
- 4 Make sure your computer does not have Java. Enter java -version and press ↵ Enter... If the message “The program 'java' can be found in the following packages' appears on the screen (Java can be found in the following packages), Java is not on the computer.
- If Java is installed, the version will be displayed on the screen.
- 5 Enter the command to install. In terminal enter sudo apt-get install default-jreand then press ↵ Enter... Java will be installed on the Ubuntu machine in the default folder.
- If this is not successful, try typing sudo apt-get install openjdk-7-jdk.
Tips
- Java can be installed using the graphical user interface, but it will take longer than using the command line.
Warnings
- Oracle Java is no longer supported on Ubuntu.