jvmnashornjjs

Nashorn JJS: set heap size on command line


Using the JJS tool for Nashorn+ JVM, how do we set JVM arguments?

I tried this:

jjs -Xmx512m test.js

but got this:

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

Sepcifically I want to set the following

-XX:MaxDirectMemorySize=512m
-Xmx512m


Solution

  • For JJS use -J before jvm args:

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