Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»JAVA»How to Install Java 17 on Ubuntu 20.04 & 18.04 LTS

    How to Install Java 17 on Ubuntu 20.04 & 18.04 LTS

    RahulBy RahulJune 10, 20182 Mins ReadUpdated:February 15, 2022

    Java 17 is the latest long-term support release for the Java SE platform. As this is a LTS version, it will be supported for till September 2024. Java 17 comes with multiple improvements and bug fixes. The workstation users should consider to upgrade to this version. Also production users can consider to upgrade after checking all the application compatibility check.

    Use this tutorial to Install Java 17 on Ubuntu 21.10, 20.04 LTS, 18.04 LTS, 16.04 LTS using PPA. Follow the below steps to Install Java on Ubuntu command line.

    To install Java pervious LTS release on your system follow below links:

    • Read this => Install Java 11 on Ubuntu 18.04 (Bionic)
    • Read this => Install Java 11 on Ubuntu 16.04 (Xenial)

    Step 1 – Install Java 17 on Ubuntu

    You need to enable additional repository to your system to install Java 17 on Ubuntu VPS. After that install Oracle Java 17 on an Ubuntu system using apt-get. This repository contains a package named oracle-java17-installer, Which is not an actual Java package. Instead of that, this package contains a script to install Java on Ubuntu.

    Open a terminal and execute below command to configure the PPA:

    sudo add-apt-repository ppa:linuxuprising/java 
    
    sudo apt update 
    sudo apt install oracle-java17-installer 
    

    During this process, you must have to accept Oracle agreement to finish installation. This will install Java 17 on your Ubuntu system.

    Step 2 – Test Java Installation

    The apt repository also provides package oracle-java17-set-default to set Java 17 as your default Java version. This package will be installed along with Java installation. To make sure execute the below command.

    sudo apt install oracle-java17-set-default 
    

    After successfully installing Oracle Java 17 using the above steps, Let’s verify the installed version using the following command.

    java -version >
    
    Output:
    java version "17.0.1" 2021-10-19 LTS Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

    Step 3 – Setup JAVA_HOME and JRE_HOME Variable

    The installer script set the environment variable for you. You can find these variables in /etc/profile.d/jdk.sh script.

    cat /etc/profile.d/jdk.sh 
    
    Output:
    export J2SDKDIR=/usr/lib/jvm/java-17-oracle export J2REDIR=/usr/lib/jvm/java-17-oracle export PATH=$PATH:/usr/lib/jvm/java-17-oracle/bin:/usr/lib/jvm/java-17-oracle/db/bin export JAVA_HOME=/usr/lib/jvm/java-17-oracle export DERBY_HOME=/usr/lib/jvm/java-17-oracle/db

    All done, you have successfully installed Java 17 on a Linux system. You may also need to install Tomcat server to run your Java web application. Use our another tutorial to Install Tomcat 7 or Install Tomcat 8 or Install Tomcat 9 on Ubuntu, Debian, and LinuxMint systems.

    install java install jdk Java jdk jre
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Apache Solr 9.0 on Debian 11/10
    Next Article How to Install Latest Java 17 on Debian 11/10

    Related Posts

    What are the Access Modifiers in Java

    Updated:August 8, 20223 Mins Read

    How to Install JAVA on Ubuntu 22.04

    Updated:May 16, 20224 Mins Read

    Java HashMap – How to Get Value from Key

    Updated:April 6, 20222 Mins Read

    Java HashMap – How to Get Key from Value

    Updated:April 6, 20222 Mins Read

    5 Methods to Print an Array in Java

    Updated:April 21, 20222 Mins Read

    How To Install Java on Debian 11

    4 Mins Read

    3 Comments

    1. Aadesh Senthilkumar on July 10, 2022 11:52 pm

      Very helpful article. I had trouble with my minecraft server because I didn’t know my default java version was set to 11 instead of 17.

      Reply
    2. Contra8 on May 29, 2019 3:01 pm

      Is this somehow affected by the new Java license Oracle published on April 16, 2019?

      Reply
    3. Raj on September 4, 2018 7:11 am

      Thanks

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How To Install Google Chrome On macOS
    • How to Install Minecraft on Ubuntu 22.04 & 20.04
    • Running a Cron job every Sunday (Weekly)
    • Running Multiple Commands At Once in Linux
    • What are the Access Modifiers in Java
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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