Play Framework 2.3运行jvm内存

时间:2015-03-30 03:05:57

标签: java playframework playframework-2.3 typesafe-activator

我试图增加应用程序的Jvm内存,但对我使用的内容并不重要,我将256Mb作为最大内存。要查看我正在使用的最大内存

val instance = Runtime.getRuntime();
val  mb = 1024 * 1024;
val maxm = ("Max Memory: " + instance.maxMemory() / mb);

我试图用...运行应用程序

activator -Xms512M -Xmx512M run
activator -mem 512 -J-server run //this doesn't run
env JAVA_OPTS="-Xms512m -Xmx512m"  &&  activator run 
env JAVA_OPTS="-mem 512" &&  activator run 
env JAVA_OPTS="-XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=512M"  &&  activator run 
env JAVA_OPTS="-DX:MetaspaceSize=64m -DX:MaxMetaspaceSize=512m"  &&  activator run 

当使用activator -mem 512 run或activator -mem 512 -J-server运行时,我收到以下错误。

[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[error] Expected letter
[error] Expected symbol
[error] Expected '!'
[error] Expected '+'
[error] Expected '++'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected ';'
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'show'
[error] Expected 'all'
[error] Expected '*'
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected key
[error] Expected '-'
[error] 512
[error] ^
[error] Not a valid command: mem (similar: set)
[error] Not a valid project ID: mem
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: mem (similar: name, makePom, make-pom)
[error] mem
[error]    ^

我是以错误的方式做这件事吗?

1 个答案:

答案 0 :(得分:2)

使用 SET 代替 ENV 并删除双引号解决。

set JAVA_OPTS=-Xms64m -Xmx512m &&  activator run 

=)