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

Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-feature-image

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

Technology

– Java
– Vutr VPS Hosting

Practice

Create Vultr Vps

Follow the link to create a Linux Vultr VPS.

Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-Ubuntu-server

Use Putty to login Vultr VPS:

Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-putty-login-vp

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:

Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-java-11-download-link

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 ->

Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-change-default-java

Set the JAVA_HOME Environment

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

Install-Java-in-Linux-Remote-Server-with-Vultr-Hosting-VPS-find-where-java-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 *

*