2
readers helped!

This helped me

How to Install Oracle Java JDK on Ubuntu Linux

This How.com.vn teaches you how to install the Oracle Java 9 JDK on Ubuntu Linux. Keep in mind that, as of March 2018, only the 64-bit version of Java 9 is available for Ubuntu.

Steps

  1. How.com.vn English: Step 1 Open Terminal.
    Open the Menu ⋮⋮⋮ and scroll down, then click
    How.com.vn English: Mac Terminal
    Terminal to do so.
    • You can also press Alt+Ctrl+T.
  2. How.com.vn English: Step 2 Remove any current versions of Java.
    This is extremely important, as failing to do so will render the following instructions useless:
    • Type in sudo apt-get purge openjdk-\*
    • Press Enter
    • Type in your password if prompted.
    • Press Y if prompted, then press Enter
    Advertisement
  3. How.com.vn English: Step 3 Enter the Java installation command.
    Type in sudo apt-get install software-properties-common and press Enter.[1]
  4. How.com.vn English: Step 4 Remove any old versions of software.
    Type in sudo apt autoremove and press Enter, then wait for old software to remove itself. This will both free up space on your computer's hard drive and prevent interference when installing Java.
    • The removal process may take several minutes.
  5. How.com.vn English: Step 5 Update packages.
    Type in sudo apt-get update and press Enter to ensure that the current software is up-to-date.
  6. How.com.vn English: Step 6 Access the Oracle Java repository.
    Type in sudo add-apt-repository ppa:webupd8team/java and press Enter.
  7. How.com.vn English: Step 7 Press ↵ Enter when prompted.
    You'll see a message that reads "Press [ENTER] to continue or Ctrl-c to cancel adding it" at the bottom of the Terminal window; this is where you'll press Enter.
  8. How.com.vn English: Step 8 Download the Java installed.
    Type in sudo apt-get install oracle-java9-installer and press Enter, then type in y and press Enter when prompted. The Java 9 installer will begin downloading, at which point a confirmation box will appear in Terminal.
  9. How.com.vn English: Step 9 Agree to the Java terms of use.
    Press Enter once to continue, then use the left arrow key to select Yes and press Enter again.
  10. How.com.vn English: Step 10 Wait for Java to download.
    Java will take upward of 20 minutes to download, so be patient. Once you see your name appear at the bottom of Terminal again, you may proceed.
  11. How.com.vn English: Step 11 Set Java 9 as the default.
    Type in sudo apt-get install oracle-java9-set-default and press Enter, then enter your password if prompted.
  12. How.com.vn English: Step 12 Check your Java version.
    Type in java -version and press Enter. You should see the following text:
    • java version "9.0.4"
  13. How.com.vn English: Step 13 Update all of your packages again.
    Type in sudo apt-get update and press Enter. This probably won't do anything, but it's a good way to ensure that both everything from Java and the rest of your software is up-to-date. Once this command finishes running, the Java JDK is installed; you can exit Terminal.
    Advertisement

Community Q&A

Search
Add New Question
  • Question
    My Java version gives me a "cannot execute binary file: Exec format error." What is wrong?
    How.com.vn English: Community Answer
    Community Answer
    You either have a corrupted copy of Java, or - more likely - you installed a version for a different unix variant and/or CPU architecture.
  • Question
    What do I do if the Oracle Java9 installer has no installable candidates?
    How.com.vn English: Community Answer
    Community Answer
    Instead, use: sudo apt install default-jre default-jdk . It seems java9 is no longer supported and not available for download the old-fashioned way.
  • Question
    When I do step 8 it doesn't work, it comes up with: "Unable to locate package oracle-java9-installer". How to make it work?
    How.com.vn English: Stephen
    Stephen
    Community Answer
    Installing Oracle Java JDK on Ubuntu Linux is a straightforward process. Here are the steps you can follow: First, update the package index on your Ubuntu system by running the following command in your terminal: "sudo apt-get update" (without the quotes). Next, add the Oracle Java PPA (Personal Package Archive) to your system by running the following command: "sudo add-apt-repository ppa:webupd8team/java". After that, update the package index again by running the following command: "sudo apt-get update". Now, you can install Oracle Java JDK by running the following command: "sudo apt-get install oracle-java8-installer".
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit

      Advertisement

      Tips

      Advertisement

      Warnings

      Advertisement

      About this article

      How.com.vn English: Jack Lloyd
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Jack Lloyd. Jack Lloyd is a Technology Writer and Editor for How.com.vn. He has over two years of experience writing and editing technology-related articles. He is technology enthusiast and an English teacher. This article has been viewed 1,588,172 times.
      How helpful is this?
      Co-authors: 24
      Updated: April 10, 2020
      Views: 1,588,172
      Article SummaryX

      1.Remove any existing versions of Java.
      2.Run " sudo add-apt-repository ppa:webupd8team/java"
      3.Run "sudo apt-get install oracle-java9-installer"
      4.Agree to the terms.
      5.Set the newest version as the default.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 1,588,172 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement