Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Install Java on Debian 9 (Stretch)

    How to Install Java on Debian 9 (Stretch)

    By RahulOctober 5, 20182 Mins Read

    This tutorial helps you to install Java on Debian 9 (Stretch) via Apt-Get. Java is a popular object-oriented, platform-independent programming language.

    Advertisement

    You can install Java based on your requirements. As an example, to run a java application you only need to install JRE (Java Runtime Environment) but for the development system, you need the JDK (Java Development Kit).

    You can either install OpenJDK or Oracle Java on your system. This tutorial covers both options for you.

    Installing OpenJDK

    OpenJDK is an open source implementation of the Java Platform standard edition. You can install it directly from the default repository on Debian 9 system.

    Install JRE:

    sudo apt install default-jre
    

    Install JDK:

    sudo apt install default-jdk
    

    Installing Oracle JAVA

    You need to configure Apt repository on your system first before beginning Java installation on Debian 9. Execute following commands to import signing key and add Java PPA on Debian.

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
    sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main"
    

    Then install Java on your system. The package oracle-java8-installer is not actual Java package, It contains scripts which automatically configure Java on Debian 9 system.

    sudo apt update
    sudo apt-get install oracle-java8-installer
    

    You can also install Java 10 on Debian 9 using these instructions.

    Switch Between Multiple Java Versions

    At this step, you have installed multiple java versions on your system. But you need to switch to different Java version. Let’s execute below command from terminal and choose appropriate installed Java on Debian 9.

    sudo update-alternatives --config java
    

    Install Java on Debian 9

    See the above screenshot, I choose 2 which will configure Oracle Java 8 as default version on my Debian system.

    install java install java on debian openjdk
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to List Manually Installed Packages in Ubuntu & Debian

    10 Bash Tricks Every Developer Should Know

    How to Validate Email Address in JavaScript

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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