Java is a popular programming language for the system software development and web application. You need to install Java Development Kit (JDK) and Java Runtime Environment (JRE) for preparation of a Java development system. You can install Oracle Java 9 on a Linux VPS from the official website. This tutorial helps you to install Java on Ubuntu and Linux Mint systems using Apt-get package manager.
Step 1 – Install Java 9 on Ubuntu
You need to enable additional repository to your system to install Java 9 on Ubuntu VPS. After that install, Oracle Java 9 on an Ubuntu system using apt-get.
sudo add-apt-repositoryppa:webupd8team/java sudo apt-getupdate sudo apt-getinstall oracle-java9-installer
Step 2 – Setup Java Environment
The installation will create a configuration file /etc/profile.d/jdk.sh for the Java environment settings. The system will automatically load these settings on every reboot to set up Java environment.
But these settings will not be available in the current session. So you change local all settings in the current setting by executing the command:
Step 3 – Verify Java Installation
After successful installation of Java 9 on Linux VPS. Run below command to check the installed and active Java version on your Linux system.
java -version java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
If you see other than Java 9 version in above output, This means you have multiple Java version’s installed on your system. Run below command to set or change default Java version on Ubuntu and Linux Mint systems.
sudo update-alternatives --config java
Enter the Selection number showing for Java 9 installation on your system and press enter.