Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

SORRY for the really long question ( I didn't want to miss any info you guys might need) BUT PLEASE HELP!

Hi, I've recently purchased a linux VPS (runs ubuntu 64 bit) I've been trying to get java to work on it for 3 days now, and i'm starting to run out of ideas and think about how much I wasted on this VPS.

I've tried installing it through:

sudo add-apt-repository ppa:webupd8team/java 
sudo apt-get update
sudo apt-get install oracle-java7-installer

(and java6 the next day - I tried uninstalling it first but not sure if it worked because I got errors)

as well as

wget https://github.com/flexiondotorg/oab-java6/raw/0.2.4/oab-java.sh -O oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh

upon completion of all of these I am able to run a java based game (the one I'm trying to host) but it crashes after a few hours, here is my batch file

screen -A -m -d -S rsps java -Xmx1700m -classpath bin:deps/GTLVote.jar:deps/poi.jar:deps/m… server.Server

To break it down the "screen -A -m -d -S rsps" is just to keep the game batch file running when I close the connection through putty.

I have also tried editing this java -Xmx1700m (3 hour crash if i have it at -Xmx800m, 6 hour crash if i have it at -Xmx1700m) but it just prolongs how long until java crashes with a hs_err_pid error saying There is insufficient memory for the Java Runtime Environment to continue. and a bunch of other code (all of it can be found here: http://pastebin.com/3ZBfYBLE)

Also, when I try java -version through putty I get an error saying

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

I was also able to host this game perfectly fine on a windows vps with similar specs (a little bit better specs)

1 Possible thing I can think of is the 2 versions of java I've tried installing have both been a 32 bit version? Other than that I have no clue, any help will be GREATLY appreciated.

share|improve this question
1  
Welcome to Ask Ubuntu. Can you please tell us how many memory your VPS has? This is an important information as you have a problem with memory and without knowing how much RAM you have it is difficult to tell what it could be. –  Uwe Plonus Jul 24 '13 at 7:49
1  
What are you trying to run? sounds like it isn't handling it's garbage that well. And why not use openjre 7? –  Dr_Bunsen Jul 24 '13 at 8:03
add comment

1 Answer 1

You need to find out the requirements of the software you are trying to run. You need to know:

  1. If it needs Java 6 or Java 7 - they are not 100% compatible.
  2. If it actually needs the Oracle JDK, or if you can use OpenJDK.
  3. How much memory it actually needs.

Then, you need to make sure you have the correct version of Java installed, and selected as the default using the update-java-alternatives tool. The webupd8team PPA is currently the best way to install the Oracle version of Java; the oab-java6 does not work for Java 6 due to changes Oracle have made to their download website. If you can use the OpenJDK, you can just install it using apt-get. Your pastebin shows that you are running the 64-bit version of the Oracle JDK.

I don't understand why running java -version would result in an error, unless perhaps you were still running your application and it is eating all your memory.

Bottom line: If Java is running out of memory, you either need to allocate it more, or your application has a memory leak. If you don't have enough physical RAM, you need a higher spec machine.

share|improve this answer
    
The software I'm trying to run SHOULD have enough allocated memory as it is a blank VPS, and I've tried both java versions, although it should work with any java. The software was not running when typing java -version, which is why I came here for help. When I ran the same software on a windows VPS it was set with Xmx800m, so a lot less memory was allocated, and it ran fine for 4 days straight un attended, so I'm not sure why it's doing this. As I'm not an expert (and I've learnt everything about using cmd line in the last 24 hours) I've reinstalled the VPS with CentOS to see if thatworks –  Ryan Jul 24 '13 at 12:27
    
You still don't mention what you are trying to run, or how much RAM your VPS has. Whoever wrote the application you are trying to run will be able to tell you what version of Java to use, how much memory to give your JVM, and any other specific requirements. If even running a plain java -version cannot allocate enough memory, something must be using it. Run ps aux and check the RSS column to see which process is using it all. –  David Edwards Jul 24 '13 at 12:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.