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»Installing Java on Ubuntu

    Installing Java on Ubuntu

    RahulBy RahulApril 4, 20182 Mins ReadUpdated:April 12, 2018

    Java is a widely used programing language for creating software, web applications. Basically, there is two type of Java environment available to configure. JDK is used for configuring Java environment for developing Java application and JRE is used for the runtime configuration.

    Multiple ways to install Java on Ubuntu

    You have two options available for installing Java on an Ubuntu system. You can choose one of them.

    #1. How to Install Default Java on Ubuntu with Apt-get

    This is the simple and quick way to install Java on Ubuntu systems. Run the following commands to install Java on an Ubuntu Linux system.

    sudo apt-get update
    sudo apt-get install default-jdk
    

    JDK also contains JRE packages but you can install default-jre package install JRE only.

    You can also install the specific Java version on your system using one of the following commands.

    sudo apt-get install openjdk-9-jdk      ## Java 9 
    sudo apt-get install openjdk-8-jdk      ## Java 8 
    

    #2. How to Install Oracle Java on Ubuntu using PPA

    The second options are to install Oracle Java. The Debian packages are not available for Oracle Java, but Webup8 team have provided you an easier way to install Oracle Java on an Ubuntu system.

    Add the following PPA to your system:

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    

    Java 8 is the LTS release available and Java 9 is the latest release available for installation. Now install Java version of your choice as below.

    sudo apt-get install oracle-java8-installer    ## Java 8 
    sudo apt-get install oracle-java9-installer    ## Java 9 
    

    Configure Default Java with Alternatives

    The update-alternatives command is used for configuring default version for your system. The systems have multiple Java versions install can use below command to set specific Java version as default

    sudo update-alternatives --config java
    

    Select default java version

    Type the selection number of Java version you want to set as default Java on your Linux system.

    Java jdk jre jvm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Compile and Run C/C++ Programs in Linux
    Next Article How to Install and Configure phpMyAdmin on Debian 9/8

    Related Posts

    How to Install JAVA on Ubuntu 22.04

    Updated:May 16, 20224 Mins Read

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    (Resolved) – ReactJS 404 Error on Page Reload

    2 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

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • 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
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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