You can use jrunscript in interactive or batch mode to execute scripts.
In interactive mode, you can type and execute scripts from the jrunscript prompt.
In batch mode, you can load and execute script files using jrunscript.
By default, jrunscript executes scripts developed using the JavaScript scripting language.
To specify a different language, you can use the –l option while executing jrunscript.
jrunscript [options]
Option | Description |
-classpath path | Specifies the path to the Java class files. |
-l language | Specifies the scripting language. |
-e script | Evaluates the given script. |
-encoding encoding | Specifies the character encoding used while reading script files. |
-f script-file | Evaluates a script file. |
-f | Reads and evaluates a script from the console. This is called interactive mode. |
-q | Lists all available script engines. |
jrunscript -e "print('hello world')"