How to install Java on Ubuntu Remote Server – Vutr Hosting VPS Example


In the tutorial, we show you how to install Java in Ubuntu Remote Server with Vutr Hosting VPS.


– Java
– Vutr VPS Hosting


Create Vultr Vps

Follow the link to create a Linux Vultr VPS.


Use Putty to login Vultr VPS:


Install Default OpenJDK

– Update apt package index:

– Install the default Java OpenJDK package:

– Verify the installation:

-> Output:

Install Oracle Java

Visit the Oracle’s downloads page, download the Java archive file:


Create a directory for the Java installation:

Extract the Java .tar.gz file:

– Create new Java alternatives:

– Check Java Version:

How to install others Java version (6, 7, 8)? -> Just follow the above steps.

Set the Default Java Version

When having multiple Java versions installed on the server, you can use update-alternatives tool to change the default version:

sudo update-alternatives --config java ->


Set the JAVA_HOME Environment

Use sudo update-alternatives --config java to find where Java is installed:


Open file /etc/environment by command: sudo nano /etc/environment
Then add JAVA_HOME at the end of the file :

Apply the changes to your current session by cmd: source /etc/environment

Verify the JAVA_HOME environment variable by cmd: echo $JAVA_HOME

By grokonez | November 23, 2018.

Related Posts

Got Something To Say:

Your email address will not be published. Required fields are marked *