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»General Articles»How to Install Java on Debian 9 (Stretch)

    How to Install Java on Debian 9 (Stretch)

    RahulBy RahulSeptember 22, 20182 Mins ReadUpdated:October 5, 2018

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

    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
    Previous ArticleHow To disable SELinux on CentOS 7
    Next Article How to Find Currently Running Processes in MySQL

    Related Posts

    Filesystem Hierarchy Structure (FHS) in Linux

    Updated:July 1, 20222 Mins Read

    What is CPU? – Definition, Types and Parts

    3 Mins Read

    How to Install Ionic Framework on Ubuntu 22.04

    3 Mins Read

    What is the /etc/hosts file in Linux

    Updated:June 27, 20222 Mins Read

    Creating DMARC Record for Your Domain

    Updated:June 29, 20223 Mins Read

    What is Computer Hardware?

    4 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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