JRUNSCRIPT(1)
π jrunscript(1) β JDK Commands π
okay bestie, sit down, we're talking about jrunscript, and bestie⦠this one's on its way out. like, the whole thing is deprecated. (more on that in a sec, don't spiral)
β¨ NAME β¨
jrunscript β runs a command-line script shell that supports interactive and batch modes. yes, both. she's versatile. she's also retiring. iykyk π
β¨ SYNOPSIS β¨
β οΈ Note, and this is important, so read it properly: This tool is experimental and unsupported. It is deprecated and will be removed in a future release. ngl, that's the whole vibe of this page. enjoy her while she's here π
jrunscript [options] [arguments]
optionsβ thejrunscriptcommand-line options you can use. head down to [Options for the jrunscript Command](#-options-for-the-jrunscript-command-) for the full list, bestie π«Άargumentsβ when you use arguments, they go right after the options or the command name. see [Arguments](#-arguments-) πΈ
β¨ DESCRIPTION β¨
jrunscript is a language-independent command-line script shell. that's the whole point of her β she doesn't gatekeep by language π
She supports two modes, and honestly both ate:
- interactive (read-eval-print) mode β you sit there, she evaluates, you vibe π¦
- batch mode β via the
-foption
By default, JavaScript is the language used. but if you're feeling β¨differentβ¨, the -l option lets you specify another language. and because Java can talk to scripting languages, jrunscript supports an exploratory programming style β meaning you can poke at stuff and see what happens, no cap π₯
If JavaScript is the language you're using, then β before it evaluates a user defined script β jrunscript initializes certain built-in functions and objects. those are documented in the API Specification for jrunscript JavaScript built-in functions. go read it, i believe in you π
β¨ OPTIONS FOR THE JRUNSCRIPT COMMAND β¨
-cp pathor-classpath pathβ tells her where the class files are that the script needs to access π-Dname=valueβ sets a Java system property. classic. iconic π-Jflagβ passesflagdirectly to the Java Virtual Machine where thejrunscriptcommand is running. straight to the JVM, no middleman π-l languageβ uses the specified scripting language. by default it's JavaScript. want another language? you must specify the corresponding script engine's JAR file with the-cpor-classpathoption. required, not optional, bestie π«Ά-e scriptβ evaluates the specified script. this is the one for one-line scripts that are specified completely on the command line. little snack-sized script πΈ-encoding encodingβ specifies the character encoding used to read script files π§-f script-fileβ evaluates the specified script file (batch mode) π-f -β enters interactive mode to read and evaluate a script from standard input β¨οΈ-helpor-?β displays a help message and exits π-qβ lists all script engines available and exits. a little engine lineup, love that for us π
β¨ ARGUMENTS β¨
here's the rules of the road, and they're honestly not that deep:
- If arguments are present and no
-eor-foption is used β the first argument is the script file, and the rest of the arguments (if any) are passed as script arguments. - If arguments are used together with
-eor-fβ all arguments are passed as script arguments. - If arguments,
-eand-fare all missing β interactive mode is used. she'll just wait for you to say something π
β¨ EXAMPLE OF EXECUTING INLINE SCRIPTS β¨
okay so inline scripts, one-liners, chef's kiss:
jrunscript -e "print('hello world')"
jrunscript -e "cat('http://www.example.com')"
β¨ EXAMPLE OF USING SPECIFIED LANGUAGE AND EVALUATE THE SCRIPT FILE β¨
picking your language and evaluating a script file, together, as a treat:
jrunscript -l js -f test.js
β¨ EXAMPLE OF INTERACTIVE MODE β¨
the full read-eval-print experience, step by step π¦:
jrunscript
js> print('Hello World\n');
Hello World
js> 34 + 55
89.0
js> t = new java.lang.Thread(function() { print('Hello World\n'); })
Thread[Thread-0,5,main]
js> t.start()
js> Hello World
js>
she literally did math and started a thread. main character energy fr π
β¨ RUN SCRIPT FILE WITH SCRIPT ARGUMENTS β¨
In this example, the test.js file is the script file. The arg1, arg2, and arg3 arguments are passed to the script. The script can access these arguments with an arguments array.
jrunscript test.js arg1 arg2 arg3
π friendly reminder that this whole tool is experimental, unsupported, deprecated, and will be removed in a future release. don't build your entire personality around her. or do, i'm not your mom π«Ά
πΈ that's the page, bestie! this one's straight out of JDK 25.0.5.0.3, dated 2026 β so go use jrunscript while she's still around, mwah π
π¦ where this page comes from
- arch rolling: jdk25-openjdk 25.0.5.0.3.u1-1 Β· LicenseRef-Java
- arch rolling: jre25-openjdk 25.0.5.0.3.u1-1 Β· LicenseRef-Java
- arch rolling: jre25-openjdk-headless 25.0.5.0.3.u1-1 Β· LicenseRef-Java
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms