• About
  • Contact
  • Cookie
  • Disclaimer
  • Privacy Policy
  • Change the purpose of use

Tnhelearning.edu.vn - Various useful general information portal

  • Photo
  • Bio
  • How To
  • Tech

How to Install Java on Linux

February 20, 2024 by admin Category: How To

You are viewing the article How to Install Java on Linux  at Tnhelearning.edu.vn you can quickly access the necessary information in the table of contents of the article below.

X

This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.

The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.

This article has been viewed 4,041 times.

This wikiHow teaches you how to install the latest version of the Java Runtime Environment (JRE) on your Linux computer.

Table of Contents

  • Steps
    • Installing on Non-RPM Linux
    • Install on RPM Linux
    • Install on Ubuntu (OpenJDK)
    • Install on Ubuntu 16.04 via PPA
  • Advice
  • Warning

Steps

Installing on Non-RPM Linux

Image titled Install Java on Linux Step 1

Image titled Install Java on Linux Step 1

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/9/9b/Install-Java-on-Linux-Step-1-Version-4.jpg/v4-728px-Install-java- on-Linux-Step-1-Version-4.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/9/9b/Install-Java-on-Linux-Step-1- Version-4.jpg/v4-728px-Install-Java-on-Linux-Step-1-Version-4.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Open the Java for Linux download page . You will see several options.
Image titled Install Java on Linux Step 2

Image titled Install Java on Linux Step 2

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/03/Install-Java-on-Linux-Step-2-Version-5.jpg/v4-728px-Install-java- on-Linux-Step-2-Version-5.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/03/Install-Java-on-Linux-Step-2- Version-5.jpg/v4-728px-Install-Java-on-Linux-Step-2-Version-5.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Click Linux . This link is in the middle of the page. The Java installation file will be downloaded.

  • You can also click on the Linux X64 version if you want to install 64-bit Java.
Image titled Install Java on Linux Step 3

Image titled Install Java on Linux Step 3

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/4f/Install-Java-on-Linux-Step-3-Version-4.jpg/v4-728px-Install-java- on-Linux-Step-3-Version-4.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/4/4f/Install-Java-on-Linux-Step-3- Version-4.jpg/v4-728px-Install-Java-on-Linux-Step-3-Version-4.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Record the filename. The latest Java version is the 8th version, but you may also need the updated version number after the “8u” at the end of the file name.

  • For example, your file might be named “jre-8u151”, this is the 8th version, update 151.
Image titled Install Java on Linux Step 4

Image titled Install Java on Linux Step 4

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/6/64/Install-Java-on-Linux-Step-4-Version-3.jpg/v4-728px-Install-java- on-Linux-Step-4-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/6/64/Install-Java-on-Linux-Step-4- Version-3.jpg/v4-728px-Install-Java-on-Linux-Step-4-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Open command line. This step will vary depending on your version of Linux, but you can usually find the command line by opening the Terminal application or clicking the bar at the top or bottom of the screen.
Image titled Install Java on Linux Step 5

Image titled Install Java on Linux Step 5

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/9/92/Install-Java-on-Linux-Step-5-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-5-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/9/92/Install-Java-on-Linux-Step-5- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-5-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Change the installation directory. Type cd into the console, press the spacebar once, then type the path (eg /usr/java/ then press ↵ Enter .
Image titled Install Java on Linux Step 6

Image titled Install Java on Linux Step 6

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/d/d8/Install-java-on-Linux-Step-6-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-6-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/d/d8/Install-Java-on-Linux-Step-6- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-6-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter the install command. Type tar zxvf , press the spacebar once, then enter the full name of the file. This depends on your Java version and when you downloaded it.

  • As of October 2017, you will have to type tar zxvf jre-8u151-linux-i586.tar .
READ More:   How to Identify Different Types of Worms in Dogs
Image titled Install Java on Linux Step 7

Image titled Install Java on Linux Step 7

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/32/Install-Java-on-Linux-Step-7-Version-3.jpg/v4-728px-Install-java- on-Linux-Step-7-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/32/Install-Java-on-Linux-Step-7- Version-3.jpg/v4-728px-Install-Java-on-Linux-Step-7-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Press ↵ Enter . Java will be installed on the computer in a directory titled “jre1.8.0_[update]” where “[update]”, where “update” is the version number (eg: 151).

Install on RPM Linux

Image titled Install Java on Linux Step 8

Image titled Install Java on Linux Step 8

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/6/63/Install-Java-on-Linux-Step-8-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-8-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/6/63/Install-Java-on-Linux-Step-8- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-8-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Open the Java for Linux download page . You will see several options.
Image titled Install Java on Linux Step 9

Image titled Install Java on Linux Step 9

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/3c/Install-Java-on-Linux-Step-9-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-9-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/3c/Install-Java-on-Linux-Step-9- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-9-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Click Linux RPM in the middle of the page. The Java installation file for RPM will be downloaded.

  • You can also click on the Linux RPM X64 version if you want to install 64-bit Java.
Image titled Install Java on Linux Step 10

Image titled Install Java on Linux Step 10

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/f/fd/Install-java-on-Linux-Step-10-Version-3.jpg/v4-728px-Install-java- on-Linux-Step-10-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/f/fd/Install-Java-on-Linux-Step-10- Version-3.jpg/v4-728px-Install-Java-on-Linux-Step-10-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Record the filename. The latest Java version is the 8th version, but you may also need the updated version number after the “8u” at the end of the file name.

  • For example, your file might be named “jre-8u151”, which is the 8th version and the 151 update.
Image titled Install Java on Linux Step 11

Image titled Install Java on Linux Step 11

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/78/Install-Java-on-Linux-Step-11-Version-3.jpg/v4-728px-Install-java- on-Linux-Step-11-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/7/78/Install-Java-on-Linux-Step-11- Version-3.jpg/v4-728px-Install-Java-on-Linux-Step-11-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Open command line. This step will vary depending on your version of Linux, but you can usually find the command line by opening the Terminal application or clicking the bar at the top/bottom of the screen.
Image titled Install Java on Linux Step 12

Image titled Install Java on Linux Step 12

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/8f/Install-Java-on-Linux-Step-12-Version-4.jpg/v4-728px-Install-java- on-Linux-Step-12-Version-4.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/8/8f/Install-Java-on-Linux-Step-12- Version-4.jpg/v4-728px-Install-Java-on-Linux-Step-12-Version-4.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter the root command. Type sudo su and press ↵ Enter . The command line will ask for the user password. [1] X Research Source
Image titled Install Java on Linux Step 13

Image titled Install Java on Linux Step 13

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/3a/Install-Java-on-Linux-Step-13-Version-5.jpg/v4-728px-Install-java- on-Linux-Step-13-Version-5.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/3a/Install-Java-on-Linux-Step-13- Version-5.jpg/v4-728px-Install-Java-on-Linux-Step-13-Version-5.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter your account password. Type the account’s password and press ↵ Enter . As long as you have super access (or root privileges) on the account, this will allow you to install Java.

  • If you do not have root access on the account, you need to enter the password of the account with root access.
Image titled Install Java on Linux Step 14

Image titled Install Java on Linux Step 14

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/5b/Install-Java-on-Linux-Step-14-Version-4.jpg/v4-728px-Install-java- on-Linux-Step-14-Version-4.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/5/5b/Install-Java-on-Linux-Step-14- Version-4.jpg/v4-728px-Install-Java-on-Linux-Step-14-Version-4.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Change the installation directory. Type cd into the console, press the spacebar once, then type the path (eg /usr/java/ then press ↵ Enter .
Image titled Install Java on Linux Step 15

Image titled Install Java on Linux Step 15

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/cf/Install-java-on-Linux-Step-15-Version-4.jpg/v4-728px-Install-java- on-Linux-Step-15-Version-4.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/c/cf/Install-Java-on-Linux-Step-15- Version-4.jpg/v4-728px-Install-Java-on-Linux-Step-15-Version-4.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter the install command. Type rpm -ivh , press space once, type the full name of the file, and then press ↵ Enter . Java will be installed on the computer.

  • The file name will depend on when you download it. As of October 2017, you will have to type rpm -ivh jre-8u151-linux-i586.rpm and then press ↵ Enter .
READ More:   How to Grow and Care for Bonsai
Upgrade file download. Type rpm -Uvh jre-8u73-linux-i586.rpm and press ↵ Enter . This will check for updates for the Java package and apply them where possible.

Install on Ubuntu (OpenJDK)

Image titled Install Java on Linux Step 17

Image titled Install Java on Linux Step 17

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/06/Install-Java-on-Linux-Step-17-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-17-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/06/Install-Java-on-Linux-Step-17- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-17-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Open command line. Press Ctrl + Alt + T on your keyboard or click the black frame icon with a white “>_” on the left side of the screen.
Image titled Install Java on Linux Step 18

Image titled Install Java on Linux Step 18

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/a/a1/Install-java-on-Linux-Step-18-Version-3.jpg/v4-728px-Install-java- on-Linux-Step-18-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/a/a1/Install-Java-on-Linux-Step-18- Version-3.jpg/v4-728px-Install-Java-on-Linux-Step-18-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter the update command. Type sudo apt-get update && sudo apt-get upgrade -y and press ↵ Enter . The package list will refresh and install all available updates for you.
Image titled Install Java on Linux Step 19

Image titled Install Java on Linux Step 19

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/88/Install-Java-on-Linux-Step-19-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-19-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/8/88/Install-Java-on-Linux-Step-19- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-19-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter the password if asked. If asked for a user password, you need to enter it and press ↵ Enter .
Image titled Install Java on Linux Step 20

Image titled Install Java on Linux Step 20

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/49/Install-Java-on-Linux-Step-20-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-20-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/4/49/Install-Java-on-Linux-Step-20- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-20-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
You need to make sure Java is not installed. Type java -version and press ↵ Enter . If you see the message “The program ‘java’ can be found in the fplowing packages” it means Java is not installed on the computer.

  • If Java is already installed, you will see a command line report about the current version of Java on your computer.
Image titled Install Java on Linux Step 21

Image titled Install Java on Linux Step 21

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/34/Install-Java-on-Linux-Step-21-Version-2.jpg/v4-728px-Install-java- on-Linux-Step-21-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/34/Install-Java-on-Linux-Step-21- Version-2.jpg/v4-728px-Install-Java-on-Linux-Step-21-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight” :546,”licensing”:”<div class=”mw-parser-output”></div>”}
Enter the install command. Type sudo apt-get install default-jre in the command line, then press ↵ Enter . Java will be installed to the default directory on the Ubuntu computer.

  • If this doesn’t work, try typing sudo apt-get install openjdk-8-jdk instead

Install on Ubuntu 16.04 via PPA

Image titled Install Java on Linux Step 22

Image titled Install Java on Linux Step 22

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/1/18/Install-java-on-Linux-Step-22.jpg/v4-728px-Install-java-on-Linux- Step-22.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/1/18/Install-java-on-Linux-Step-22.jpg/v4-728px-Install- Java-on-Linux-Step-22.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser -output”></div>”}
First of all, this is a third-party installation package, so the Linux distribution’s package management system (often referred to as distro) cannot inventory this package, so you need to be careful when using it. However, you still have to press Ctrl + Alt + T first to open the terminal.
Image titled Install Java on Linux Step 23

Image titled Install Java on Linux Step 23

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/5/57/Install-Java-on-Linux-Step-23.jpg/v4-728px-Install-Java-on-Linux- Step-23.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/5/57/Install-Java-on-Linux-Step-23.jpg/v4-728px-Install- Java-on-Linux-Step-23.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser -output”></div>”}
You need to make sure the system is up to date. After typing sudo apt-get update && sudo apt-get upgrade -y , the system will prompt you for your password, type the password and then press ↵ Enter , note that no dots or asterisks will appear. out as you enter and this is normal.

  • While this step isn’t technically required, it’s always recommended before we install any content, so it’s a good idea to keep your system up to date to avoid problems.
READ More:   How to Grow Green Bell Peppers
Image titled Install Java on Linux Step 24

Image titled Install Java on Linux Step 24

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/b/bf/Install-java-on-Linux-Step-24.jpg/v4-728px-Install-java-on-Linux- Step-24.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/b/bf/Install-Java-on-Linux-Step-24.jpg/v4-728px-Install- Java-on-Linux-Step-24.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser -output”></div>”}
Add the PPA repository to the system. Type sudo add-apt-repository ppa:webupd8team/java and then press ↵ Enter .
Image titled Install Java on Linux Step 25

Image titled Install Java on Linux Step 25

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/c8/Install-java-on-Linux-Step-25.jpg/v4-728px-Install-java-on-Linux- Step-25.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/c/c8/Install-Java-on-Linux-Step-25.jpg/v4-728px-Install- Java-on-Linux-Step-25.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser -output”></div>”}
Update the package lists again. Type sudo apt-get update and wait for the packages to refresh.
Image titled Install Java on Linux Step 26

Image titled Install Java on Linux Step 26

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/1/15/Install-java-on-Linux-Step-26.jpg/v4-728px-Install-Java-on-Linux- Step-26.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/1/15/Install-Java-on-Linux-Step-26.jpg/v4-728px-Install- Java-on-Linux-Step-26.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser -output”></div>”}
Install package. Type sudo apt-get install oracle-java9-installer -y .

  • You may be asked to enter a password, then type it in and press ↵ Enter , note that no periods or asterisks will appear as you type and this is normal.
  • Image titled Install Java on Linux Step 27

    Image titled Install Java on Linux Step 27

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/0e/Install-java-on-Linux-Step-27.jpg/v4-728px-Install-java-on-Linux- Step-27.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/0e/Install-Java-on-Linux-Step-27.jpg/v4-728px-Install- Java-on-Linux-Step-27.jpg”,”smallWidth”:460,”smallHeight”:345,”bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser -output”></div>”}
    Set Oracle’s Java as default. On many Ubuntu derivatives, OpenJDK is usually the default Java used. If you want Oracle’s Java to be used as default, you need to type sudo apt install oracle-java9-set-default .
  • Advice

    • Although there are ways to load Java using a program interface (such as a graphical user interface – GUI), the installation process takes significantly less time if you use the command line.

    Warning

    • Oracle Java is no longer supported on Ubuntu. You can use OpenJDK (free version of Oracle Java) instead.
    • Oracle does not distribute .deb packages, any .deb packages for Oracle from Oracle come from third parties and may harm your system.
    X

    This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.

    The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.

    This article has been viewed 4,041 times.

    This wikiHow teaches you how to install the latest version of the Java Runtime Environment (JRE) on your Linux computer.

    Thank you for reading this post How to Install Java on Linux at Tnhelearning.edu.vn You can comment, see more related articles below and hope to help you with interesting information.

    Related Search:

    Related Posts

    How to Create Curved Text in Photoshop
    How to fall asleep faster
    How to Install FBReader to Read eBooks

    Category: How To

    Previous Post: « How to Remove the Roots of Trees
    Next Post: How to Change Microsoft Account Primary Email Address »

    Copyright © 2025 · Tnhelearning.edu.vn - Useful Knowledge