How to Install Java 10 on Ubuntu 18.04/16.04 LTS
In this tutorial we’ll Install Java 10 on Ubuntu 18.04 LTS, 16.04 LTS (and its forks) using PPA. There are two types of JAVA installation available which are JDK and JRE. JDK (Java Development Kit) provides to develop new Java applications, which includes Java compiler. JRE (Java Runtime Environment) provides the runtime environment for any Java application with applets. The Java development kit requires JDK and JRE both should be installed on the system to create new Java Applications.
Lets Get Started :
STEP 1
Install PPA from https://launchpad.net/~linuxuprising/+archive/ubuntu/java
apt-get install -y software-properties-common add-apt-repository ppa:linuxuprising/java apt-get update
STEP 2
Install java 10 via command :
apt-get install oracle-java10-installer
To set Java 10 as default Version run this command :
apt-get install oracle-java10-set-default
Verify the java Version :
java -version
Output will as follows :
root@mysterydata:~# java -version java version "10.0.1" 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
STEP 3 :
Setup JAVA_HOME and JRE_HOME Environment Variable :
It is necessary to add this environment variable in order to run the java apps flawlessly to add run this bash script :
sh /etc/profile.d/jdk.sh
Or do it manually via below commands :
export J2SDKDIR=/usr/lib/jvm/java-10-oracle export J2REDIR=/usr/lib/jvm/java-10-oracle export PATH=$PATH:/usr/lib/jvm/java-10-oracle/bin:/usr/lib/jvm/java-10-oracle/db/bin export JAVA_HOME=/usr/lib/jvm/java-10-oracle export DERBY_HOME=/usr/lib/jvm/java-10-oracle/db
Thats it java 10 is now successfully installed on Ubuntu(and its forks) systems.