playframework/playframework — pull request #1928 by huntc (2013-11-10 23:15:17+00:00)
Title: JAVA_OPTS not honoured

If I set the JAVA_OPTS environment variable to, e.g.:

$ echo $JAVA_OPTS
-Xms256m -Xmx2048m -XX:PermSize=128m -XX:MaxPermSize=1200m

and then start a Play 2.2 application (the default Java one generated using "play new app"), the options are not honoured. jconsole shows:

-Xms1024m
-Xmx1024m
-XX:MaxPermSize=256m

This is contrary to the behaviour documented by "bin/app -help":

$ bin/app -help
Usage: [options]

-h | -help print this message
-v | -verbose this runner is chattier
-d | -debug set sbt log level to debug
-mem set memory options (default: , which is -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=128m)
-jvm-debug Turn on JVM debugging, open at the given port.

# java version (default: java from PATH, currently java version "1.6.0_65")
-java-home alternate JAVA_HOME

# jvm options and output control
JAVA_OPTS environment variable, if unset uses ""
-Dkey=val pass -Dkey=val directly to the java runtime
-J-X pass option -X directly to the java runtime
(-J is stripped)

In the case of duplicated or conflicting options, the order above
shows precedence: JAVA_OPTS lowest, command line options highest.