All tutorials

Installing Java to VPS

Installing Java to VPS

if you have ever tried to install a Minecraft server to the Linux environment or any other program that depends on Java virtual environment, then you probably had a situation where the server requires you to install Java or simply to upgrade to Java 11, 16 or 17 version. That's why in this tutorial we will get to know how to check if and what version our server has, then how to prepare for installation, and later how to quickly do the installation itself. 


Does my server have Java installed?

To know if your server has installed a Java virtual environment we can do that in few simple steps.

   1. Connect to the server with an SSH program we want. In our case, we'll be using Putty.

   2. Enter this command:

java -version

   3. If the Java environment was installed we should see similar text to this: OpenJDK version (number of java version is installed) is installed.


Preparations to install Java

Before starting the installation we have to update applications that are on our server, we can do that with the following commands.


Comand that updates the applications lists you have installed

sudo apt-get update


Comand that updates the applications from the list

sudo apt-get upgrade 


After launching these commands and updating the applications in the server, we can continue the installation process.


Oracle Java 8 installation 


Let's begin the installation by downloading Java files. In the command line we enter this command:

wget https://raw.githubusercontent.com/chrishantha/install-java/master/install-java.sh



Also, download Java Development Kit (JDK):

wget http://g09.rfox.cloud/jdk.tar.gz



Now we give installation permission for the install-java.sh file with this command:

chmod +x install-java.sh


With the last step enter this command which installs Java 8 to our virtual machine:

yes | ./install-java.sh -f jdk.tar.gz


Oracle Java 11 installation 


Let's begin the installation by downloading Java files. In the command line we enter this command:

wget https://raw.githubusercontent.com/chrishantha/install-java/master/install-java.sh


Also, download Java Development Kit (JDK):

wget http://g09.rfox.cloud/jdk11.tar.gz



Now we give installation permission for the install-java.sh file with this command:

chmod +x install-java.sh


With the last step enter this command which installs Java 8 to our virtual machine:

yes | ./install-java.sh -f jdk11.tar.gz



Oracle Java 16 installation 


Let's begin the installation by downloading Java files. In the command line we enter this command:

wget https://raw.githubusercontent.com/chrishantha/install-java/master/install-java.sh


Also, download Java Development Kit (JDK):

wget http://g09.rfox.cloud/jdk16.tar.gz



Now we give installation permission for the install-java.sh file with this command:

chmod +x install-java.sh


With the last step enter this command which installs Java 8 to our virtual machine:

yes | ./install-java.sh -f jdk16.tar.gz


Oracle Java 17 installation 


Let's begin the installation by downloading Java files. In the command line we enter this command:

wget https://raw.githubusercontent.com/chrishantha/install-java/master/install-java.sh


Also, download Java Development Kit (JDK):

wget http://g09.rfox.cloud/jdk17.tar.gz



Now we give installation permission for the install-java.sh file with this command:

chmod +x install-java.sh


With the last step enter this command which installs Java 8 to our virtual machine:

yes | ./install-java.sh -f jdk17.tar.gz


Final steps

After the installation, we should always check if our virtual machine has the correct Java version installed with this command:

java -version

Similar tutorials

Linux Tutorials