jbang

runs Java programs as scripts without build tools

TLDR

Run Java script
$ jbang [script.java]
Create new script
$ jbang init [script.java]
Run with dependencies
$ jbang [script.java]
Edit in IDE
$ jbang edit [script.java]
Install as command
$ jbang app install [script.java]
Run from URL
$ jbang [https://example.com/script.java]

SYNOPSIS

jbang [options] command [args]

DESCRIPTION

jbang runs Java programs as scripts without build tools. It handles dependencies, compilation, and execution automatically.The tool supports inline dependency declarations using comments. It enables shell-script style Java programming.

PARAMETERS

init FILE

Create new script.
run FILE
Run script (default).
edit FILE
Open in IDE.
app install FILE
Install script as app.
--deps GAV
Add Maven dependencies.
--java VERSION
Use specific Java version.
--help
Display help information.

INSTALL

brew install jbang
nix profile install nixpkgs#jbang

CAVEATS

Requires Java. Dependency download on first run. Scripts use comment directives.

HISTORY

jbang was created by Max Rydahl Andersen to make Java scripting as easy as Python or Bash scripts.

SEE ALSO

java(1), javac(1), kotlin(1)