Changing your JDK version (Cloud/VPS plans)

Note* Cloud/VPS plans created after 03/20/2016 include our new JDK Tool that allows for easy changes of your active JDK version.

If you are on such a plan, please follow this guide instead: Changing your JDK version (Private JVM plans)

For any Cloud/VPS plans purchased before 03/20/2016 please, follow the instructions below:

To install a specific JDK version on your server or switch between installed ones, please follow this guide:

  1. If you will be installing a new JDK, download the “tar.gz” version of the needed JDK version first.

We recommend this to be done via the vendor website -

  1. Connect to your server via SSH and place the downloaded file into the location: /usr/local/

An easy way to upload a file directly from your local machine to your server via SSH is with the “SCP” command (Linux OS only), to upload the file your can use the following line:

scp-P 2222 /File-Path-On-Your-PC/JDK-File\_Name.tar.gzroot@Your-Server-IP:/usr/local

Note* Please replace the file paths/names with the ones appropriate in yourcase. If you are running an SSH client over Windows OS you may need an additional plug-in to use SCP, consult your SSH application help section.

After the upload is complete, change to our working directory with: cd/usr/local/

  1. Run the following command once inside the directory:

tar-xzvf JDK-File-Name.tar.gz

and then

rm JDK-File-Name.tar.gz

  1. Next, the “catalina.sh” file needs to be edited. The file is located here:

/home/cpanel-username/jvm/your-apache-tomcat-folder/bin/

To edit the file use either of the following commands:

nano/home/username/jvm/your-apache-tomcat-folder/bin/catalina.sh

or alternatively

vi/home/username/jvm/your-apache-tomcat-folder/bin/catalina.sh

Add the following data to the second row of the file along with the quotes: 

JAVA\_HOME="/usr/local/Extracted-JDK-Folder-Name/"

If you are only changing between already installed JDK versions, simply change the “catalina.sh” file by changing the folder name to the one you wish to use!

Save the file and restart your JVM from your cPanel, the new JDK should now be working fine. 

If you need additional assistance or would like to have the JDK Tool installed on your server, please contact us via our LiveChat support channel, we will be happy to assist you!