• Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Java on Debian 9 (Stretch)

Written by Rahul, Updated on 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.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Debian 10
  • Download Ubuntu 20.04 LTS – DVD ISO Images
  • Linux Run Commands As Another User
  • How to Check PHP Version (Apache/Nginx/CLI)
  • How To Install and Configure GitLab on Ubuntu 20.04
  • How to Install PyCharm on Ubuntu 20.04
  • How to Check Ubuntu Version with Command or Script
  • How to Set all directories to 755 And all files to 644
© 2013-2021 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy