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 Latest Java 17 on Debian 11/10

    How to Install Latest Java 17 on Debian 11/10

    RahulBy RahulJune 11, 20183 Mins ReadUpdated:February 15, 2022

    How do I install Java 17 on Debian? The first Oracle Java 17 stable version was released on September 2021, and available to download and install. Java 17 comes with multiple improvements and bug fixes. The workstation users should consider to upgrade to this version.

    This tutorial will help you to install Java 17 on Debian 11/10/9 systems using PPA and apt-get command. Ubuntu and Linux Mint users use the below link to install Java on their system.

    • Read this => Install Java 8 LTS on Debian
    • Read this => Install latest Java on Ubuntu & LinuxMint

    Step 1 – Add PPA to System

    The webupd8 team has built a Java installer package for Debian systems. You need to add that PPA repository to your system for installing Java 17 on Debian.

    Create a new Apt configuration file /etc/apt/sources.list.d/java-17-debian.list, and edit in text editor.

    sudo nano /etc/apt/sources.list.d/java.list 
    

    and add following content in it.

    deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main
    deb-src http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main
    

    Now import GPG key on your system for validating packages before installing them.

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EA8CACC073C3DB2A 
    

    Step 2 – Install Latest Java on Debian

    You are all set to start Java installation on Debian. Run the following commands to update apt-cache and then install Java 17 on the Debian system using the apt-get package manager.

    sudo apt update 
    sudo apt install oracle-java17-installer 
    

    The installer will prompt for accept Oracle terms in order to continue Java installation on Debian. Accept the terms and complete setup.

    Step 3 – Verify Java Installation

    Finally, you have successfully installed Oracle Java on your Debian system. Let’s use the following command to verify the installed version of Java on your system.

    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 4 – Setup Java Environment

    The Webupd8 PPA repository also provides a package to set environment variables, Install this package using the following command.

    sudo apt install oracle-java17-set-default 
    

    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

    Step 5 – Switching Java Version

    The Debian systems have installed multiple Java version’s can switch between them. The update-alternatives command line utility allows switching the Java version.

    Run the following command to list selection list:

    sudo update-alternatives --config java 
    

    This command will list all the installed Java version (Configured with update-alternatives). You will see the list like below:

    Output:
    There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode * 2 /usr/lib/jvm/java-17-oracle/bin/java 1091 manual mode Press to keep the current choice[*], or type selection number: 2

    Type a number to select Java version to set as default Java version on your Debian system.

    References:
    https://launchpad.net/~linuxuprising/+archive/java

    debian install java Java latest java
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Java 17 on Ubuntu 20.04 & 18.04 LTS
    Next Article How to Access Remote Mailbox on Linux Terminal

    Related Posts

    Setup Selenium with Python and Chrome on Ubuntu & Debian

    Updated:June 20, 20224 Mins Read

    How to Setup Squid Proxy Server on Ubuntu and Debian

    Updated:June 17, 20225 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

    Leave A Reply Cancel Reply

    Recent Posts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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