This article will show you how to install Java 8 on Ubuntu 20.04 LTS. Java is one of the most popular programming languages in the world. It is used to develop a wide range of applications, from mobile apps to enterprise-level software. If you are an Ubuntu user and want to install Java 8 on your system, you have come to the right place. In this blog, we will guide you through the process of installing Java 8 on Ubuntu 20.
Features of Java 8
Java 8 is a significant release of the Java programming language, which was released in March 2014. It introduced several new features and enhancements to the language, runtime, and libraries, making it easier and more efficient to develop applications. Here are some of the key features of Java 8:
- Lambda expressions: Lambda expressions are a new language feature that allows developers to write more concise and readable code. They are anonymous functions that can be passed around and used as data. Lambda expressions are used extensively in Java 8’s new Stream API, which provides a functional way of working with collections.
- Stream API: The Stream API is a new feature in Java 8 that provides a functional way of working with collections. It allows developers to process collections in a parallel and declarative way, making it easier to write efficient and concise code.
- Date and Time API: Java 8 introduced a new Date and Time API that provides a more comprehensive and flexible way of working with dates and times. The new API makes it easier to handle time zones, date arithmetic, and formatting.
- Default methods: Default methods are a new feature that allows developers to add new methods to existing interfaces without breaking existing implementations. This feature enables the evolution of interfaces and makes it easier to write more modular code.
- Optional class: The Optional class is a new class in Java 8 that provides a way to represent values that may or may not be present. It makes it easier to write more robust and defensive code by avoiding null pointer exceptions.
- Nashorn JavaScript engine: Java 8 includes a new JavaScript engine called Nashorn, which is a lightweight, high-performance engine that can run JavaScript code directly on the JVM. This feature makes it easier to integrate JavaScript code with Java applications.
- Parallel array sorting: Java 8 introduced a new method for sorting arrays in parallel, which can significantly improve the performance of sorting large arrays.
- Method references: Method references are a new language feature that allows developers to pass a method as a parameter to another method. This feature makes it easier to write more concise and readable code.
In summary, Java 8 introduced several new features and enhancements that make it easier and more efficient to develop applications. These features include lambda expressions, the Stream API, the Date and Time API, default methods, the Optional class, the Nashorn JavaScript engine, parallel array sorting, and method references.
Steps to install Java 8 on Ubuntu 20
Step 1: Update the apt repository
Before installing Java 8, it is essential to update your system to ensure that you have the latest security updates and bug fixes. To update your system, open the terminal and run the following command:
$ sudo apt update
Step 2: Install Java on Ubuntu
OpenJDK is an open-source implementation of the Java Platform. It is free to use and provides excellent performance. To install Java 8 using OpenJDK, run the following command:
sudo apt install openjdk-8-jdk
Sample Output.
sysadminxpert@Ubuntu:~$ sudo apt install openjdk-8-jdk Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: ca-certificates-java fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni libice-dev libpthread-stubs0-dev libsm-dev libx11-6 libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev Suggested packages: default-jre libice-doc libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-8-demo openjdk-8-source visualvm icedtea-8-plugin fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei The following NEW packages will be installed: ca-certificates-java fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev The following packages will be upgraded: libx11-6 1 upgraded, 21 newly installed, 0 to remove and 613 not upgraded. Need to get 43.5 MB/44.1 MB of archives. After this operation, 162 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 java-common all 0.72 [6,816 B] Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jre-headless amd64 8u312-b07-0ubuntu1~20.04 [28.2 MB] Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jre-headless amd64 8u312-b07-0ubuntu1~20.04 [28.2 MB] Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jre-headless amd64 8u312-b07-0ubuntu1~20.04 [28.2 MB] Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jre-headless amd64 8u312-b07-0ubuntu1~20.04 [28.2 MB] Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jre-headless amd64 8u312-b07-0ubuntu1~20.04 [28.2 MB] Get:3 http://us.archive.ubuntu.com/ubuntu focal/main amd64 ca-certificates-java all 20190405ubuntu1 [12.2 kB] Get:4 http://us.archive.ubuntu.com/ubuntu focal/main amd64 fonts-dejavu-extra all 2.37-1 [1,953 kB] Get:5 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libatk-wrapper-java all 0.37.1-1 [53.0 kB] Get:6 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libatk-wrapper-java-jni amd64 0.37.1-1 [45.1 kB] Get:7 http://us.archive.ubuntu.com/ubuntu focal/main amd64 xorg-sgml-doctools all 1:1.11-1 [12.9 kB] Get:8 http://us.archive.ubuntu.com/ubuntu focal/main amd64 x11proto-dev all 2019.2-1ubuntu1 [594 kB] Get:9 http://us.archive.ubuntu.com/ubuntu focal/main amd64 x11proto-core-dev all 2019.2-1ubuntu1 [2,620 B] Get:10 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libice-dev amd64 2:1.0.10-0ubuntu1 [47.8 kB] Get:11 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libpthread-stubs0-dev amd64 0.4-1 [5,384 B] Get:12 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libsm-dev amd64 2:1.2.3-1 [17.0 kB] Get:13 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libxau-dev amd64 1:1.0.9-0ubuntu1 [9,552 B] Get:14 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libxdmcp-dev amd64 1:1.1.3-0ubuntu1 [25.3 kB] Get:15 http://us.archive.ubuntu.com/ubuntu focal/main amd64 xtrans-dev all 1.4.0-1 [68.9 kB] Get:16 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libxcb1-dev amd64 1.14-2 [80.5 kB] Get:17 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libx11-dev amd64 2:1.6.9-2ubuntu1.2 [647 kB] Get:18 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libxt-dev amd64 1:1.1.5-1 [395 kB] Get:19 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jre amd64 8u312-b07-0ubuntu1~20.04 [69.9 kB] Get:20 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jdk-headless amd64 8u312-b07-0ubuntu1~20.04 [8,295 kB] Get:21 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 openjdk-8-jdk amd64 8u312-b07-0ubuntu1~20.04 [2,969 kB] Fetched 26.7 MB in 3min 33s (126 kB/s) (Reading database ... 145919 files and directories currently installed.) Preparing to unpack .../00-libx11-6_2%3a1.6.9-2ubuntu1.2_amd64.deb ... Unpacking libx11-6:amd64 (2:1.6.9-2ubuntu1.2) over (2:1.6.9-2ubuntu1) ... Selecting previously unselected package java-common. Preparing to unpack .../01-java-common_0.72_all.deb ... Unpacking java-common (0.72) ... Selecting previously unselected package openjdk-8-jre-headless:amd64. Preparing to unpack .../02-openjdk-8-jre-headless_8u312-b07-0ubuntu1~20.04_amd64.deb ... Unpacking openjdk-8-jre-headless:amd64 (8u312-b07-0ubuntu1~20.04) ... Selecting previously unselected package ca-certificates-java. Preparing to unpack .../03-ca-certificates-java_20190405ubuntu1_all.deb ... Unpacking ca-certificates-java (20190405ubuntu1) ... Selecting previously unselected package fonts-dejavu-extra. Preparing to unpack .../04-fonts-dejavu-extra_2.37-1_all.deb ... Unpacking fonts-dejavu-extra (2.37-1) ... Selecting previously unselected package libatk-wrapper-java. Preparing to unpack .../05-libatk-wrapper-java_0.37.1-1_all.deb ... Unpacking libatk-wrapper-java (0.37.1-1) ... Selecting previously unselected package libatk-wrapper-java-jni:amd64. Preparing to unpack .../06-libatk-wrapper-java-jni_0.37.1-1_amd64.deb ... Unpacking libatk-wrapper-java-jni:amd64 (0.37.1-1) ... Selecting previously unselected package xorg-sgml-doctools. Preparing to unpack .../07-xorg-sgml-doctools_1%3a1.11-1_all.deb ... Unpacking xorg-sgml-doctools (1:1.11-1) ... Selecting previously unselected package x11proto-dev. Preparing to unpack .../08-x11proto-dev_2019.2-1ubuntu1_all.deb ... Unpacking x11proto-dev (2019.2-1ubuntu1) ... Selecting previously unselected package x11proto-core-dev. Preparing to unpack .../09-x11proto-core-dev_2019.2-1ubuntu1_all.deb ... Unpacking x11proto-core-dev (2019.2-1ubuntu1) ... Selecting previously unselected package libice-dev:amd64. Preparing to unpack .../10-libice-dev_2%3a1.0.10-0ubuntu1_amd64.deb ... Unpacking libice-dev:amd64 (2:1.0.10-0ubuntu1) ... Selecting previously unselected package libpthread-stubs0-dev:amd64. Preparing to unpack .../11-libpthread-stubs0-dev_0.4-1_amd64.deb ... Unpacking libpthread-stubs0-dev:amd64 (0.4-1) ... Selecting previously unselected package libsm-dev:amd64. Preparing to unpack .../12-libsm-dev_2%3a1.2.3-1_amd64.deb ... Unpacking libsm-dev:amd64 (2:1.2.3-1) ... Selecting previously unselected package libxau-dev:amd64. Preparing to unpack .../13-libxau-dev_1%3a1.0.9-0ubuntu1_amd64.deb ... Unpacking libxau-dev:amd64 (1:1.0.9-0ubuntu1) ... Selecting previously unselected package libxdmcp-dev:amd64. Preparing to unpack .../14-libxdmcp-dev_1%3a1.1.3-0ubuntu1_amd64.deb ... Unpacking libxdmcp-dev:amd64 (1:1.1.3-0ubuntu1) ... Selecting previously unselected package xtrans-dev. Preparing to unpack .../15-xtrans-dev_1.4.0-1_all.deb ... Unpacking xtrans-dev (1.4.0-1) ... Selecting previously unselected package libxcb1-dev:amd64. Preparing to unpack .../16-libxcb1-dev_1.14-2_amd64.deb ... Unpacking libxcb1-dev:amd64 (1.14-2) ... Selecting previously unselected package libx11-dev:amd64. Preparing to unpack .../17-libx11-dev_2%3a1.6.9-2ubuntu1.2_amd64.deb ... Unpacking libx11-dev:amd64 (2:1.6.9-2ubuntu1.2) ... Selecting previously unselected package libxt-dev:amd64. Preparing to unpack .../18-libxt-dev_1%3a1.1.5-1_amd64.deb ... Unpacking libxt-dev:amd64 (1:1.1.5-1) ... Selecting previously unselected package openjdk-8-jre:amd64. Preparing to unpack .../19-openjdk-8-jre_8u312-b07-0ubuntu1~20.04_amd64.deb ... Unpacking openjdk-8-jre:amd64 (8u312-b07-0ubuntu1~20.04) ... Selecting previously unselected package openjdk-8-jdk-headless:amd64. Preparing to unpack .../20-openjdk-8-jdk-headless_8u312-b07-0ubuntu1~20.04_amd64.deb ... Unpacking openjdk-8-jdk-headless:amd64 (8u312-b07-0ubuntu1~20.04) ... Selecting previously unselected package openjdk-8-jdk:amd64. Preparing to unpack .../21-openjdk-8-jdk_8u312-b07-0ubuntu1~20.04_amd64.deb ... Unpacking openjdk-8-jdk:amd64 (8u312-b07-0ubuntu1~20.04) ... Setting up java-common (0.72) ... Setting up libpthread-stubs0-dev:amd64 (0.4-1) ... Setting up xtrans-dev (1.4.0-1) ... Setting up fonts-dejavu-extra (2.37-1) ... Setting up libx11-6:amd64 (2:1.6.9-2ubuntu1.2) ... Setting up xorg-sgml-doctools (1:1.11-1) ... Setting up libatk-wrapper-java (0.37.1-1) ... Setting up libatk-wrapper-java-jni:amd64 (0.37.1-1) ... Setting up openjdk-8-jre-headless:amd64 (8u312-b07-0ubuntu1~20.04) ... update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode Setting up ca-certificates-java (20190405ubuntu1) ... head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem Adding debian:GeoTrust_Primary_Certification_Authority.pem Adding debian:Certum_Trusted_Network_CA.pem Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem Adding debian:TeliaSonera_Root_CA_v1.pem Adding debian:Entrust_Root_Certification_Authority_-_G2.pem Adding debian:COMODO_Certification_Authority.pem Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem Adding debian:DST_Root_CA_X3.pem Adding debian:SwissSign_Gold_CA_-_G2.pem Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem Adding debian:ePKI_Root_Certification_Authority.pem Adding debian:DigiCert_Global_Root_G3.pem Adding debian:TWCA_Root_Certification_Authority.pem Adding debian:DigiCert_Global_Root_G2.pem Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem Adding debian:Deutsche_Telekom_Root_CA_2.pem Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem Adding debian:AffirmTrust_Premium.pem Adding debian:Starfield_Class_2_CA.pem Adding debian:LuxTrust_Global_Root_2.pem Adding debian:XRamp_Global_CA_Root.pem Adding debian:GlobalSign_Root_CA.pem Adding debian:Trustis_FPS_Root_CA.pem Adding debian:TWCA_Global_Root_CA.pem Adding debian:Baltimore_CyberTrust_Root.pem Adding debian:IdenTrust_Commercial_Root_CA_1.pem Adding debian:DigiCert_Assured_ID_Root_CA.pem Adding debian:Certum_Trusted_Network_CA_2.pem Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem Adding debian:TrustCor_RootCert_CA-1.pem Adding debian:DigiCert_Assured_ID_Root_G3.pem Adding debian:E-Tugra_Certification_Authority.pem Adding debian:COMODO_RSA_Certification_Authority.pem Adding debian:thawte_Primary_Root_CA_-_G2.pem Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem Adding debian:AffirmTrust_Networking.pem Adding debian:Hongkong_Post_Root_CA_1.pem Adding debian:Chambers_of_Commerce_Root_-_2008.pem Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem Adding debian:COMODO_ECC_Certification_Authority.pem Adding debian:QuoVadis_Root_CA_2_G3.pem Adding debian:Microsec_e-Szigno_Root_CA_2009.pem Adding debian:GDCA_TrustAUTH_R5_ROOT.pem Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem Adding debian:Sonera_Class_2_Root_CA.pem Adding debian:T-TeleSec_GlobalRoot_Class_2.pem Adding debian:QuoVadis_Root_CA.pem Adding debian:QuoVadis_Root_CA_3_G3.pem Adding debian:Certinomis_-_Root_CA.pem Adding debian:DigiCert_Trusted_Root_G4.pem Adding debian:DigiCert_Assured_ID_Root_G2.pem Adding debian:Go_Daddy_Class_2_CA.pem Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem Adding debian:thawte_Primary_Root_CA.pem Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem Adding debian:SecureTrust_CA.pem Adding debian:CA_Disig_Root_R2.pem Adding debian:TrustCor_RootCert_CA-2.pem Adding debian:Global_Chambersign_Root_-_2008.pem Adding debian:ssl-cert-snakeoil.pem Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem Adding debian:GeoTrust_Global_CA.pem Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem Adding debian:QuoVadis_Root_CA_2.pem Adding debian:CFCA_EV_ROOT.pem Adding debian:TrustCor_ECA-1.pem Adding debian:AC_RAIZ_FNMT-RCM.pem Adding debian:thawte_Primary_Root_CA_-_G3.pem Adding debian:AffirmTrust_Premium_ECC.pem Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem Adding debian:QuoVadis_Root_CA_3.pem Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem Adding debian:USERTrust_ECC_Certification_Authority.pem Adding debian:Amazon_Root_CA_1.pem Adding debian:AddTrust_External_Root.pem Adding debian:ISRG_Root_X1.pem Adding debian:GeoTrust_Universal_CA_2.pem Adding debian:DigiCert_Global_Root_CA.pem Adding debian:Cybertrust_Global_Root.pem Adding debian:AffirmTrust_Commercial.pem Adding debian:Actalis_Authentication_Root_CA.pem Adding debian:SSL.com_EV_Root_Certification_Authority_RSA_R2.pem Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem Adding debian:SwissSign_Silver_CA_-_G2.pem Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem Adding debian:certSIGN_ROOT_CA.pem Adding debian:VeriSign_Universal_Root_Certification_Authority.pem Adding debian:Secure_Global_CA.pem Adding debian:Entrust_Root_Certification_Authority.pem Adding debian:GlobalSign_Root_CA_-_R2.pem Adding debian:SecureSign_RootCA11.pem Adding debian:Amazon_Root_CA_3.pem Adding debian:EC-ACC.pem Adding debian:GlobalSign_Root_CA_-_R3.pem Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem Adding debian:SSL.com_Root_Certification_Authority_RSA.pem Adding debian:NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem Adding debian:Comodo_AAA_Services_root.pem Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem Adding debian:Taiwan_GRCA.pem Adding debian:QuoVadis_Root_CA_1_G3.pem Adding debian:USERTrust_RSA_Certification_Authority.pem Adding debian:SSL.com_EV_Root_Certification_Authority_ECC.pem Adding debian:SSL.com_Root_Certification_Authority_ECC.pem Adding debian:EE_Certification_Centre_Root_CA.pem Adding debian:Security_Communication_Root_CA.pem Adding debian:Certplus_Class_2_Primary_CA.pem Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem Adding debian:Buypass_Class_2_Root_CA.pem Adding debian:ACCVRAIZ1.pem Adding debian:Network_Solutions_Certificate_Authority.pem Adding debian:Izenpe.com.pem Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem Adding debian:Security_Communication_RootCA2.pem Adding debian:OISTE_WISeKey_Global_Root_GC_CA.pem Adding debian:Amazon_Root_CA_2.pem Adding debian:T-TeleSec_GlobalRoot_Class_3.pem Adding debian:Certigna.pem Adding debian:GlobalSign_Root_CA_-_R6.pem Adding debian:SZAFIR_ROOT_CA2.pem Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem Adding debian:GeoTrust_Universal_CA.pem Adding debian:Amazon_Root_CA_4.pem Adding debian:Atos_TrustedRoot_2011.pem Adding debian:Buypass_Class_3_Root_CA.pem done. Setting up openjdk-8-jre:amd64 (8u312-b07-0ubuntu1~20.04) ... update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode Setting up openjdk-8-jdk-headless:amd64 (8u312-b07-0ubuntu1~20.04) ... update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javah to provide /usr/bin/javah (javah) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/hsdb to provide /usr/bin/hsdb (hsdb) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/clhsdb to provide /usr/bin/clhsdb (clhsdb) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jps to provide /usr/bin/jps (jps) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javap to provide /usr/bin/javap (javap) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jar to provide /usr/bin/jar (jar) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jfr to provide /usr/bin/jfr (jfr) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode Setting up openjdk-8-jdk:amd64 (8u312-b07-0ubuntu1~20.04) ... update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode Processing triggers for fontconfig (2.13.1-2ubuntu3) ... Processing triggers for desktop-file-utils (0.24-1ubuntu2) ... Processing triggers for mime-support (3.64ubuntu1) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Processing triggers for gnome-menus (3.36.0-1ubuntu1) ... Processing triggers for libc-bin (2.31-0ubuntu9) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for ca-certificates (20190110ubuntu1) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. done. Processing triggers for sgml-base (1.29.1) ... Setting up x11proto-dev (2019.2-1ubuntu1) ... Setting up libxau-dev:amd64 (1:1.0.9-0ubuntu1) ... Setting up libice-dev:amd64 (2:1.0.10-0ubuntu1) ... Setting up libsm-dev:amd64 (2:1.2.3-1) ... Setting up libxdmcp-dev:amd64 (1:1.1.3-0ubuntu1) ... Setting up x11proto-core-dev (2019.2-1ubuntu1) ... Setting up libxcb1-dev:amd64 (1.14-2) ... Setting up libx11-dev:amd64 (2:1.6.9-2ubuntu1.2) ... Setting up libxt-dev:amd64 (1:1.1.5-1) ... sysadminxpert@Ubuntu:~$
Step 3: Check the Java version on Ubuntu
$ java -version
Sample output:
sysadminxpert@Ubuntu:~$ java -version openjdk version "1.8.0_312" OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07) OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode) sysadminxpert@Ubuntu:~$
Step 4: Configure JAVA_HOME in Ubuntu
Add the below line in ~/.bashrc
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
Step 5: Verify JAVA_HOME path in Ubuntu
source ~/.bashrc echo $JAVA_HOME
Sample Output:
sysadminxpert@Ubuntu:~$ echo $JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
Congratulations! You have successfully installed Java 8 on Ubuntu 20.
This is the end of the article. we have shown you how to install Java 8 on Ubuntu 20.04
FAQ’s:
Q1: Why do I need Java 8 on Ubuntu 20.04?
A1: Java 8 is required for running applications and software that are specifically developed to be compatible with this version. Some legacy applications and systems still rely on Java 8.
Q2: How can I check if Java 8 is already installed on my Ubuntu 20.04 system?
A2: You can check if Java 8 is installed by running the following command:
java -version
Q3: Can I install multiple Java versions on Ubuntu 20.04?
A3: Yes, you can install multiple Java versions on Ubuntu 20.04. Use the update-alternatives
command to switch between different Java versions.
Q4: Why is it recommended to set the JAVA_HOME environment variable?
A4: Setting the JAVA_HOME
environment variable helps in specifying the location where Java is installed. This can be useful for applications that require the Java path to be explicitly defined.
Q5: How do I uninstall Java 8 from Ubuntu 20.04?
A5: To uninstall Java 8, you can use the following command:
sudo apt remove openjdk-8-jdk
Q6: What is the default installation directory for Java 8 on Ubuntu 20.04?
A6: The default installation directory for OpenJDK 8 on Ubuntu 20.04 is typically /usr/lib/jvm/java-8-openjdk-amd64/
.
Q7: Can I use Oracle JDK instead of OpenJDK for Java 8 on Ubuntu 20.04?
A7: Yes, you can use Oracle JDK instead of OpenJDK if you prefer. However, the installation steps would be different, and you need to download the Oracle JDK package from the official website.
Q8: Is Java 8 still supported and receiving updates?
A8: As of my last knowledge update in January 2022, Oracle’s public updates for Java 8 have ended, but there are other providers like AdoptOpenJDK that continue to provide updates. Always check the latest information for the most accurate details.
These FAQs should provide additional information and address common questions that users might have when installing Java 8 on Ubuntu 20.04.
See also:
How to Upgrade Java 11 To Java 16 on Rocky Linux or AlmaLinux
How to Upgrade Java 8 To Java 11 on Rocky Linux or AlmaLinux
How to Install Java 8 on Rocky Linux 8 / CentOS 8 / RHEL 8: A Step-by-Step Guide
How to Upgrade Java 8 to Java 11 on Ubuntu 20
Steps to Upgrade Java 8 to Java 11 on CentOS 7