Changing your JDK version (Cloud/VPS plans) Print

  • 0

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: 

https://clientarea.mochahost.com/knowledgebase/678


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

Toinstall a specific JDK version on your server or switch betweeninstalled 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 donevia the vendor website - http://www.oracle.com/

 

2.Connect to your server viaSSH and place the downloaded file into thelocation: /usr/local/

 

Aneasy way to upload a file directly from your local machine to yourserver 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.gz[email protected]:/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, changeto our working directory with: cd/usr/local/

 

3.Runthe following command onceinside the directory:

 

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

 

andthen

 

rm JDK-File-Name.tar.gz

 

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

 

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

 

Toedit the file use either ofthe following commands:

 

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

 

oralternatively

 

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

 

Addthe following data to the second row of the file alongwith 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 thefolder name to the one you wish to use!

 

Save the file and restart your JVM from your cPanel, the new JDKshould 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!


Was this answer helpful?

« Back