Oracle Java JDK is a development environment for developing applications and tools based on Java. It can also be used for testing applications and program developed using the Java programming language.
This brief tutorial is going to show students and new users how to download Oracle Java JDK / JRE and install on Ubuntu 17.04 / 17.10. Other tutorials may show you how to get Java installed via third-party PPA tools.
You could also install OpenJava JDK / JRE easily using the apt-get command. However, this post is going show you how to download and install Java from its original repository instead of the opensource version of via third-party.
To get Java JDK / JRE installed, follow the steps below:
Step 1: Download Java JDK
Java JDK can be downloaded from the link below directly from Oracle’s website. Choose the .tar.gz pacakge for Linux x86 or x64 and download.
After downloading go and extract the downloaded package.
Step 2: Extract and Install Java
Now that you’ve downloaded the correct archive package for your system, run the commands below to extract it.
tar -xvf ~/Downloads/jdk-*.tar.gz
Next, create a directory to store the Java compiler packages. you can name it what ever you want, but it nice to name it after the Java version you’re installing.
sudo mkdir -p /usr/lib/jvm/jdk1.8.0_131/
Next, run the commands below to copy the extract Java content into the newly created directory.
sudo mv jdk1.8*/* /usr/lib/jvm/jdk1.8.0_131/
Then run the commands below to configure Java
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_131/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_131/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_131/bin/javaws" 1
The commands above should configure Java to work and function with Ubuntu. To test if Java is installed correctly, run the commands below.
You should see Java as been installed.
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Congratulations! You’ve just successfully install Java JDK
This brief tutorial shows students and new users how to easily install Java JDK on Ubuntu 17.04 / 17.10. It is an alternate method that are available across the internet that show users how to install Java from third-party PPAs or the OpenJDK versions.
This method installs the original versions from Oracle.
You may also like the post below:
Install Nginx, MariaDB and PHP on Ubuntu 17.04 / 17.10