Close Menu
Java HelpsJava Helps
    What's Hot

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022
    Facebook X (Twitter) Instagram
    Java HelpsJava Helps
    • Home
    • How To
      1. Install
      2. Run
      3. Configure
      4. View All

      How to Install MySQL with phpMyAdmin on Ubuntu?

      December 4, 2022

      Install The Latest IntelliJ IDEA on Linux

      November 28, 2022

      Install The Latest Apache Maven on Linux

      November 27, 2022

      Install The Latest Oracle JDK on Linux

      November 27, 2022

      Run NiFi Cluster in Docker with SSL Enabled

      December 6, 2022

      How to Run Apache NiFi Docker on Mac M1?

      December 1, 2022

      How to Run Apache NiFi on Docker?

      December 1, 2022

      Create A New Maven Project In IntelliJ IDEA

      November 29, 2022

      Things To Do After Installing IntelliJ IDEA

      December 20, 2022

      How to Set Proxy for IntelliJ IDEA?

      December 20, 2022

      How to Set Proxy for Maven?

      December 6, 2022

      How to Create a Fat JAR Using Maven?

      December 5, 2022

      Things To Do After Installing IntelliJ IDEA

      December 20, 2022

      How to Set Proxy for IntelliJ IDEA?

      December 20, 2022

      Manage GitHub Artifact Storage Quota

      December 6, 2022

      Run NiFi Cluster in Docker with SSL Enabled

      December 6, 2022
    • Hello World
      1. Framework
      2. Library
      3. View All

      JPA Hello World! using Hibernate and MySQL

      December 3, 2022

      Jersey 3.x – Hello World!

      December 2, 2022

      Microservices Framework for Java (MSF4J) – Hello World!

      December 1, 2022

      How to Parse PCAP files in Java?

      November 30, 2022

      JPA Hello World! using Hibernate and MySQL

      December 3, 2022

      Jersey 3.x – Hello World!

      December 2, 2022

      Microservices Framework for Java (MSF4J) – Hello World!

      December 1, 2022

      How to Parse PCAP files in Java?

      November 30, 2022
    • More
      • Privacy Policy
        • Java Helps
        • Android Apps
      • Contact US
      • About
    Facebook X (Twitter) Instagram
    Java HelpsJava Helps
    Home » Install Oracle Java Development Kit 19 on Linux
    Install Oracle Java Development Kit
    Install Oracle Java Development Kit
    Install

    Install Oracle Java Development Kit 19 on Linux

    Gobinath LoganathanBy Gobinath LoganathanNovember 27, 2022Updated:December 4, 2022No Comments4 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Even though OpenJDK is available in most of the official Linux repositories, some applications require Oracle Java Development Kit for better performance. This article shows you how to manually install Oracle JDK 19 on Linux systems regardless of the distribution. Oracle JDK 19.0.1 is used in this article to demonstrate the installation. In the provided commands, replace the version-specific paths and file names according to your downloaded version.

    If you came here for a different version of Java, we got you covered. Here is the list of articles on how to install different versions of the Oracle Java Development Kit on Linux:

    • Install Oracle Java Development Kit 8 on Linux
    • Install Oracle Java Development Kit 11 on Linux
    • Install Oracle Java Development Kit 17 on Linux
    • Install Oracle Java Development Kit 19 on Linux
    • Install The Latest Oracle Java Development Kit on Linux

    Download Oracle JDK 19

    Download the latest JDK(jdk-19_linux-x64_bin.tar.gz) from this official site:

    Download

    If you want to download to a remote server or simply prefer the terminal to download the file, use the following command:

    wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/java/19/latest/jdk-19_linux-x64_bin.tar.gz

    Install Oracle JDK 19

    Step 1:
    Open the terminal (Ctrl + Alt + T) and enter the following command to create the parent directory to deploy the JDK. If the directory already exists, you can ignore this command and move to the next step.

    sudo mkdir /usr/lib/jvm

    Step 2:
    Enter the following command to change the directory.

    cd /usr/lib/jvm

    Step 3:
    Extract the jdk-19-linux-x64_bin.tar.gz file in the jvm directory using this command.

    sudo tar -xvzf ~/Downloads/jdk-19_linux-x64_bin.tar.gz

    Above command assumes, the JDK filename is jdk-19_linux-x64_bin.tar.gz and it is located in the ~/Downloads folder. If your downloaded file is in any other location, change the command according to your path.

    Run the ls command to make sure that the jdk-19.0.1 folder is there. Prior to Java 17, the tar file used to have the minor version in the filename but from Java 17 onwards the tar filename doesn’t have the minor version. Therefore, make sure that you have the expected Java version and change the following commands according to the minor version.


    Setup The Environment

    Step 1:
    Enter the following command to open the environment variables file. According to your personal preference, you can choose any text editor instead of nano.

    sudo nano /etc/environment

    Step 2:
    In the opened file, add the following bin folder to the existing PATH variable. Note that the PATH variables must be separated by a colon.

    /usr/lib/jvm/jdk-19.0.1/bin

    Append the following environment variable to the end of the file.

    JAVA_HOME="/usr/lib/jvm/jdk-19.0.1"

    A sample environment file before making these changes would look like the following:

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

    The same file after making the changes should look like this:

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk-19.0.1/bin"
    JAVA_HOME="/usr/lib/jvm/jdk-19.0.1"

    Save the changes and close the editor. If you are using nano as in this article, the shortcut to save the changes is Ctrl + O; the shortcut to close nano is Ctrl + X. To learn more about setting environment variables and/or setting the environment variable without root privilege, check How to Set Environment Variables in Linux.


    Step 3:
    Sometimes an existing JDK installation might have a shortcut added to the /usr/bin directory. Therefore setting the PATH environment variable alone may not change the default Java compiler and runtime. To update these alternative shortcuts, run the following commands:

    sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-19.0.1/bin/java" 0
    sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-19.0.1/bin/javac" 0
    sudo update-alternatives --set java /usr/lib/jvm/jdk-19.0.1/bin/java
    sudo update-alternatives --set javac /usr/lib/jvm/jdk-19.0.1/bin/javac

    Step 4:
    To verify the setup enter the following commands and make sure that they print the location of java and javac as you have provided in the previous step.

    update-alternatives --list java
    update-alternatives --list javac

    Step 5:
    Restart the computer (or just log out and log in) and open a new terminal.


    Step 6:
    Enter the following command.

    java -version

    If you get the Java version 19.0.1 as the output, you have successfully installed the Oracle JDK on your Linux system. If you have any questions or feedback, please comment below.

    install linux oracle jdk
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    How to Install MySQL with phpMyAdmin on Ubuntu?

    December 4, 2022

    Install The Latest IntelliJ IDEA on Linux

    November 28, 2022

    Install The Latest Apache Maven on Linux

    November 27, 2022

    Install The Latest Oracle JDK on Linux

    November 27, 2022

    Install Oracle Java Development Kit 11 on Linux

    November 27, 2022

    Install Oracle Java Development Kit 17 on Linux

    November 27, 2022
    Don't Miss
    Configure

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    IntelliJ Idea: the famous IDE for JVM languages including Java, Scala, and Kotlin. If you…

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022

    Manage GitHub Artifact Storage Quota

    December 6, 2022
    Our Picks

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022

    Manage GitHub Artifact Storage Quota

    December 6, 2022
    About Us
    About Us

    Java Helps is the platform to share all about the Java ecosystem. All the sample code available on Java Helps articles are published under Apache 2.0 License. Readers are free to use them according to the Apache 2.0 License.

    "The world is my town; its people my kinsmen."
    -Kaṉiyan Pūngunṟanār

    Email Us: www.javahelps@gmail.com

    Our Picks

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022
    New Comments

      Type above and press Enter to search. Press Esc to cancel.

      Go to mobile version