JRUNSCRIPT(1)

πŸ“¦ version 17.0.19.0, in opensuse-leap 16.0

πŸ¦‹ JRUNSCRIPT(1) β€” the manual page, but make it make sense πŸ¦‹

Okay so bestie, listen up πŸ’– This is the manual page for jrunscript β€” a command-line script shell that runs scripts in all kinds of languages. It's giving "I contain multitudes" energy, periodt. We're in the JDK Commands section of the manual, and this tool is lowkey experimental and unsupported (more on that in a sec, don't panic).


✨ NAME ✨

jrunscript β€” run a command-line script shell that supports interactive and batch modes. No cap, that's literally what it does 🫢


🌸 SYNOPSIS 🌸

⚠️ Real talk first: This tool is experimental and unsupported. Just so we're clear, bestie πŸ’€
jrunscript [options] [arguments]
  • options β€” the command-line options for jrunscript that you can use. Scroll down to [Options](#-options-for-the-jrunscript-command-) for the full tea β˜•
  • arguments β€” when you use them, they go immediately after the options or the command name. See [Arguments](#-arguments-) for the details πŸ’…

πŸŽ€ DESCRIPTION πŸŽ€

The jrunscript command is a language-independent command-line script shell. Iconic behavior, honestly πŸ‘‘

It supports two modes of script execution:

  • Interactive (read-eval-print) mode β€” you type, it answers, you vibe πŸ¦‹
  • Batch mode (via the -f option) β€” you hand it a file and it does the thing

By default, the language is JavaScript, but you can use the -l option to specify a different language. By using Java-to-scripting-language communication, jrunscript supports an exploratory programming style. It's giving "let's just see what happens" energy and I'm obsessed 🧚

If JavaScript is used, then before it evaluates a user-defined script, the jrunscript command initializes certain built-in functions and objects. Those are documented in the API Specification for jrunscript JavaScript built-in functions β€” iykyk πŸ“š


πŸ’… OPTIONS FOR THE JRUNSCRIPT COMMAND πŸ’…

Okay here's the whole menu, bestie. Every single flag, exactly as written, no edits, no cap:

  • -cp path or -classpath path β€” tells it where any class files are that the script needs to access. It's giving "here's where my stuff lives" 🏠
  • -Dname=value β€” sets a Java system property. Name equals value, simple as that ✨
  • -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, JavaScript is used. To use other scripting languages, you must specify the corresponding script engine's JAR file with the -cp or -classpath option. Don't forget the JAR, bestie, or it's not gonna work 😭
  • -e script β€” evaluates the specified script. This option can be used to run one-line scripts that are specified completely on the command line. One line, one vibe, done πŸ’«
  • -encoding encoding β€” specifies the character encoding used to read script files. Let there be (correctly decoded) text πŸ™
  • -f script-file β€” evaluates the specified script file (batch mode). File goes in, script comes out πŸ“
  • -f - β€” enters interactive mode to read and evaluate a script from standard input. That dash is not a typo, it's a whole mood πŸŒ€
  • -help or -? β€” displays a help message and exits. The classic "wait, how do I use this again" move πŸ™ˆ
  • -q β€” lists all script engines available and exits. A little show-and-tell of what engines you've got πŸ‘‘

🌈 ARGUMENTS 🌈

Okay this part is a little conditional, so stay with me:

  • If arguments are present and no -e or -f option is used, then the first argument is the script file and the rest of the arguments, if any, are passed as script arguments.
  • If arguments and the -e or the -f option are used, then all arguments are passed as script arguments.
  • If arguments -e and -f are missing, then the interactive mode is used. Party time πŸŽ‰

πŸ”₯ EXAMPLE OF EXECUTING INLINE SCRIPTS πŸ”₯

jrunscript -e "print('hello world')"

jrunscript -e "cat('http://www.example.com')"

Look at that. Inline. One line. Slay. πŸ’…


⭐ EXAMPLE OF USING SPECIFIED LANGUAGE AND EVALUATE THE SCRIPT FILE ⭐

jrunscript -l js -f test.js

Specify the language with -l js, point it at a file with -f test.js, and you're off. Iconic combo 🫢


🧚 EXAMPLE OF INTERACTIVE MODE 🧚

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>

The js> prompt is the main character here, obviously πŸ‘‘ Type, hit enter, watch it go. The t.start() line even sneaks in a Hello World from the thread β€” it's giving multitasking queen 🌸


πŸ’œ 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. Fr fr, that's how it works πŸ“

jrunscript test.js arg1 arg2 arg3

And that's the whole page, bestie! This manual page is from JDK 17, dated 2021 β€” so if you're reading this in the future, don't come for me about version numbers. Catch you later, go run some scripts πŸ’–βœŒοΈ

πŸ“¦ where this page comes from
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • opensuse-leap 16.0: java-17-openj9-devel 17.0.19.0-bp160.1.1 Β· Apache-1.1 AND Apache-2.0 AND EPL-2.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-only WITH Classpath-exception-2.0 AND LGPL-2.0-only AND MPL-1.0 AND MPL-1.1 AND LicenseRef-SUSE-Public-Domain AND W3C
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms