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 Oracle Java on Debian 10 (Buster)

    How To Install Oracle Java on Debian 10 (Buster)

    RahulBy RahulMarch 4, 20193 Mins ReadUpdated:December 16, 2019

    Java is a popular programming language for system software development and web application. You need to install the Java Development Kit (JDK) and Java Runtime Environment (JRE) for the setup of the Java development environment. This tutorial will guide you to install Oracle Java 13 version on Debian 10 Buster Linux system.

    Step 1 – Prerequisites

    First of all, log in to Debian 10 Buster system as the sudo user and install some required packages on your Debian system.

    sudo -i
    apt update
    apt install wget libasound2 libasound2-data
    

    Step 2 – Download Java Debian Package

    Download the latest Java SE Development Kit 13 LTS debian file release from its official download page or use following commands to download from command line.

    wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/13.0.1+9/cec27d702aa74d5a8630c65ae61e4305/jdk-13.0.1_linux-x64_bin.deb
    

    Step 3 – Install Oracle Java on Debian 10

    Now, use the Debian package installer utility (dpkg) to install a downloaded Java package on your system. Simply run the following command on the system terminal.

    dpkg -i jdk-13.0.1_linux-x64_bin.deb
    

    The Java 13 has been installed on your system. If you have multiple version’s of Java installed on the same system. Use the following commands to set Java 13 as default version on your system:

    update-alternatives --install /usr/bin/java java  /usr/lib/jvm/jdk-13.0.1/bin/java 2
    update-alternatives --config java
    

    Use above command only If there is multiple Java version installed on your Debian 10 Linux system.

    After using the above commands, you also need to other binaries to set as default for the JDK installation. Execute the commands to set javac and jar as default:

    update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-13.0.1/bin/jar 2
    update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13.0.1/bin/javac 2
    update-alternatives --set jar /usr/lib/jvm/jdk-13.0.1/bin/jar
    update-alternatives --set javac /usr/lib/jvm/jdk-13.0.1/bin/javac
    

    Step 4 – Verify Java Version

    Therefore Java 13 has successfully installed on your Debian 10 Buster system. Now check the currently active Java version by running the following command.

    java -version
    
    java version "13.0.1" 2019-10-15
    Java(TM) SE Runtime Environment (build 13.0.1+9)
    Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
    

    Step 5 – Configure Java Environment Variables

    Most of the Java-based applications uses environment variables to work. Create a script as below. Now set all the required environment variables for Java. This file will automatically reload settings on system reboot.

    sudo nano /etc/profile.d/jdk.sh
    

    Now, Add/Update following values:

    File: /etc/profile.d/jdk.sh
    export J2SDKDIR=/usr/lib/jvm/jdk-13.0.1
    export J2REDIR=/usr/lib/jvm/jdk-13.0.1
    export PATH=$PATH:/usr/lib/jvm/jdk-13.0.1/bin:/usr/lib/jvm/jdk-13.0.1/db/bin
    export JAVA_HOME=/usr/lib/jvm/jdk-13.0.1
    export DERBY_HOME=/usr/lib/jvm/jdk-13.0.1/db
    

    Then save your file and exit. Then load these setting to current active shell also

    source /etc/profile.d/jdk.sh
    

    You have successfully installed Java 13.0.1 on Debian 10 Buster Linux system.

    Buster Debian 10 Java oracle java
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Download and Upload files with SFTP Command
    Next Article How to Detect the Desktop Environment in Linux Command Line

    Related Posts

    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

    How to Install Tomcat 10 on Debian 10

    Updated:February 18, 20225 Mins Read

    8 Comments

    1. Phil on December 15, 2019 8:38 pm

      This article is inaccurate. The typos are the least of it (they only bug me because if there are typos in the copy, there may be typos in the command input code) but off the bat, the information is prefaced by installing Java on “Debian 10 Stretch” and that is not the name for this distribution. The current Debian 10 OS is nicknamed “Buster.” This isn’t a huge deal either, except it makes me think this article was either updated from an older one and potentially having a mix of current and outdated information, or that the author doesn’t know much about Linux and is simply spitting out copy.

      All of this is fine, it’s just hard to trust an article of very specific installation commands that was written in such a hurry.

      Reply
      • Rahul on December 19, 2019 8:51 am

        Thanks Phil. I have updated the tutorial and tried to fix typos.

        Reply
    2. Slarti on November 8, 2019 7:23 am

      Thank you for this.

      Is there a way to put Oracle in the repository, so I can get updates with apt?

      Are there instruction, but for the old version and controversial information on the internet.

      Reply
      • Rahul on November 12, 2019 7:31 am

        Hi, You can install Oracle Java 13. Other versions required Oracle subscription. I have updated article to Install Java 13 on Debian 10.

        Reply
        • Slarti on November 16, 2019 6:35 am

          Thanks a lot!

          Reply
    3. John W Foster on August 16, 2019 9:03 pm

      change all the references that say “jdk-11.0.2” to “jdk-11.0.4” or what ever version you downloaded.

      Reply
      • Marcelo Brisolla on May 31, 2020 10:07 am

        Where will the JRE be located?

        Reply
    4. Andriy on July 21, 2019 3:16 pm

      update-alternatives: error: alternative path /usr/lib/jvm/jdk-11.0.2/bin/java doesn’t exist

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.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.