Use multiple parameters with jjs in linux shebang script

If you try to use multiple parameters in the script on a linux OS like this,
#!/usr/bin/jjs -strict -scripting -fv

you will see something like this:
"-strict -scripting -fv" is not a recognized option. Use “-h” or “-help” to see a list of all supported options.

That happens because the linux interpreter is using all the parameters as a unique parameter.
The workaround is to use the *-J-Dnashorn.args* like

#!/usr/bin/jjs -J-Dnashorn.args= -strict -scripting -fv

If you try to use multiple parameters in the script on a linux OS like this,

#!/usr/bin/jjs -strict -scripting -fv

you will see something like this:

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

That happens because the linux interpreter is using all the parameters as a unique parameter.
The work around is to use the -J-Dnashorn.args like
#!/usr/bin/jjs -J-Dnashorn.args= -strict -scripting -fv
and it will work like a breeze.

Leave a Reply