Limit Java Heap Space for play framework globaly

前端 未结 9 1590
無奈伤痛
無奈伤痛 2020-12-04 14:22

I have a very old linux system and installed java and play framework. When I run java I get:

java -version
Error occurred during initialization of VM
Could n         


        
9条回答
  •  爱一瞬间的悲伤
    2020-12-04 15:24

    After googling more around I found this discussion. The problem is, that my Linux System is running in an openvz container:

    The reason why Java complains is because on start up, it sees that the machine has more than 2 GB of RAM, so it starts up in server mode, which tries to allocate all the memory, which then fails because it is inside a VPS.

    I could fix the java startup problem by changing /usr/java/jdk1.6.0_26/jre/lib/i386/jvm.cfg from:

    -client IF_SERVER_CLASS -server
    -server KNOWN
    -hotspot ALIASED_TO -client
    -classic WARN
    -native ERROR
    -green ERROR
    

    to:

    #-client IF_SERVER_CLASS -server
    -client KNOWN
    -server KNOWN
    -hotspot ALIASED_TO -client
    -classic WARN
    -native ERROR
    -green ERROR
    

    Now I can run any play command. Maybe this helps other people having similar problems related to container based virtualization.

    BR, Rene

提交回复
热议问题