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
In Play 2.2 and Java 7, this is what I used.
$ target/universal/stage/bin/foo -mem 256 -J-server
For the detail of -mem, please see:
$ target/universal/stage/bin/foo -h
Just ran into this on my laptop running Fedora and using Play 2.0 when simply starting the interactive shell. I found that the build script is setting the memory values by default to pretty high values.
To fix this I had to edit the $play_dir/framework/build
script and change the values manually, at the end of the script it does the following to launch:
java ${DEBUG_PARAM} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M ...
Just change the -Xmx/-Xms values (and possibly the permgen) accordingly.
It appears that the play
command you run is actually a Python script which invokes other Play Framework python modules, which eventually invoke the java
command as subprocess.
Looking at the source code for the code that runs for the dependencies
command, there doesn't appear to be any logic to load an environment variable or anything else to specify the max heap size as the -Xmx
argument. In other words, the Python code from Play which invokes the JVM in this script has no way to specify the max heap size from the default.
Normally, you can specify Java command line arguments when you call play using the following pattern.
play run <appname> -Xmx256M -Xms256M
However, looking at the python code for the play run
command and the play dependencies
command, they invoke Java in different ways.
The play dependencies command invokes Java without passing through -X commands (for some reason, it passes through -D commands, but not -X). Therefore, there is nothing you can do, apart from editing the deps.py
file in framework/pym/play/commands and hard coding the -Xmx and -Xms settings into this file.
This not a long term solution, and I would suggest you raise a ticket on Play to allow these settings to be read from command line, or from the application.conf, but for now, I see this approach as your only option.
Play does not recognize -XX options. Instead use -DX.
I faced the same issue. Try increasing --XX:MaxHeapSize to a higher allocation. Here is my configuration in path/to/framework/build
java -Xms512M -Xmx1300M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -XX:MaxHeapSize=512m...