Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Linux out of memory on VPS

I have a OpenVZ VPS running CentOS 6.3 64 bit and when I try to install JRE 7 64bit using the command:

rpm -Uvh java.rpm

It gives me this error:

Preparing...                ########################################### [100%]
   1:jre                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/rt.pack
        jsse.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/jsse.pack
        charsets.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/charsets.pack
        localedata.jar...
Error: Could not open input file: /usr/java/jre1.7.0_09/lib/ext/localedata.pack

I then tried the command:

java -version

And it gives me this error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine
Error: A fatal exception has occurred. Program will exit.

Why does this happen if I have more than enough RAM on the VPS to run this (1GB)? Could it be an issue with the host node of the VPS?

Thanks

EDIT 1: Link to beancounter screenshot http://puu.sh/1xwxB

EDIT 2: Link to htop screenshot http://puu.sh/1xwDl

share|improve this question

marked as duplicate by Michael Hampton, HopelessN00b, Ward, EightBitTony, Iain Dec 6 '12 at 8:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Those "errors" are spurious and can be ignored. The real problem is you don't have as much memory in that VPS as you think you do. Post a copy of your /proc/user_beancounters. –  Michael Hampton Dec 5 '12 at 21:22
    
I have added a screenshot of the user_beancounters via a link –  user1710563 Dec 5 '12 at 21:26
    
Yep, it's the same problem, and the same answer as in the question I flagged this as a duplicate of. –  Michael Hampton Dec 5 '12 at 21:27
    
Java's default heap size of 128M pushes you over your guaranteed memory limit. Therefore the memory allocation can fail if the host is overcommitted. You will need to use the -Xms and -Xmx options to run your JVM, or (even better) switch to anything but OpenVZ. –  Michael Hampton Dec 5 '12 at 21:42
add comment

1 Answer

Depending on what you want to do I'd suggest stop using OpenVZ and use some real virtualization solution like KVM.

Try running you java app using this command:

java -Xms16m 
share|improve this answer
add comment

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