Managing Java Files on your VPS & Troubleshooting Java
Many people often have issues using Java applications within a Linux environement.
To keep plans affordable, most hosting companies will offer Linux operating systems instead of Windows.
This is because:
Linux often performs better, has lower requirements Linux is free (versus thousands of dollars for Windows server licensing) so it keeps costs low for customers Linux can pretty much do everything a Windows machine can, with more support and flexibility
However, you may run into some "issues" using Java on Linux. We'll be addressing the issues on Ubuntu 14 w/ LXDE, which is what we use for our servers.
I need a different version of Java
Our VPS plans meant for use with Java usually have two versions installed: Oracle Java 6 and Oracle Java 8 One is for backwards compatibility and the other is for newer applications. The default is set to Java 6, but programs open in Java 8 by default. Sometimes your program will require a different Java version, or you may prefer a different version You will need <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">PuTTY</a>. Once downloaded, enter your server's IP, click 'Open' and enter root as your username, then paste your password. There are different versions of Java: Oracle Java To install Oracle Java, you need to do a manual install. However, there's <a href="http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html">a guide here</a> that might help. OpenJDK Installing OpenJDK is easy. Just type in apt-get update and then once it's updated type in apt-get install openjdk-7-jre to install version 7 You can look up the repository package name for other versions you require Please note that you may still need to update the default by using the command update-alternatives --config java and then selecting version The version of Ubuntu we use is meant to be lightweight. This has it's disadvantages. If you change your Java version, you have to open the .jar via terminal To open via terminal, go to your start menu and find XTerm which is your terminal application Type in java -jar jarname.jar where jarname.jar is the file's name, after going to the directory where the Java file is located For example, to go to the desktop directory on your desktop, type in cd /root/Desktop/
Downloading a new Jar file
If you need to download a new Jar file that is not included on your server, just use Mozilla and download it Move it to the proper folder and use the cd command to go to the directory, as described above Type in chmod a+x jarname.jar where jarname.jar is the file's name. This will mark your Java file as executable, so you may now open it.
Program opens but crashes
Please run the Java file from Terminal by typing java -jar <filename>.jar Review the info and make a support ticket
We've hope that's helped. If you're not already a customer, we recommend becoming one, as we can assist you further if this tutorial did not help resolve your issue.