Nashorn JJS:在命令行上设置堆大小

Nashorn JJS: set heap size on command line

使用Nashorn+ JVM的JJS工具,如何设置JVM参数?

我试过这个:

jjs -Xmx512m test.js

但得到了这个:

"-Xmx512m" is not a recognized option. Use "-h" or "-help" to see a list of all supported options.

具体我想设置如下

-XX:MaxDirectMemorySize=512m
-Xmx512m

对于 JJS,在 jvm args 之前使用 -J:

-J-Xmx512m -J-XX:MaxDirectMemorySize=512m