JRUNSCRIPT(1)

πŸ“¦ version 25.0.5.0.3.u1, in arch rolling

πŸ’… 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 β€” the jrunscript command-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:

  1. interactive (read-eval-print) mode β€” you sit there, she evaluates, you vibe πŸ¦‹
  2. batch mode β€” via the -f option

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 path or -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 β€” passes flag directly to the Java Virtual Machine where the jrunscript command 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 -cp or -classpath option. 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 ⌨️
  • -help or -? β€” 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 -e or -f option 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 -e or -f β†’ all arguments are passed as script arguments.
  • If arguments, -e and -f are 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