id = "jbang"
name = "JBang"
homepage = "https://www.jbang.dev/documentation/jbang/latest/configuration.html"
description = "A Java launcher for running source files and scripts."
executables = ["jbang"]
[dotfiles]
paths = ["~/.jbang/jbang.properties"]
exclude = ["~/.jbang/cache/"]
secret = []
side_effect = false
[commands]
format = 1
label = "Run a script"
description = "Run a Java, Kotlin, Groovy or JShell script, jar or app with JBang. Other subcommands (init, build, export, app, catalog, jdk, ...), debugging and profiling options are not covered."
quality = "ai-draft"
parser = { end_of_options = "--", interleave = "posix", long_equals = true, short_attached = true, short_bundles = false }
[[commands.source]]
id = "docs"
kind = "manual"
url = "https://raw.githubusercontent.com/jbangdev/jbang/main/docs/modules/ROOT/pages/running.adoc"
revision = "main 2026-10-27"
evidence = """
jbang --deps com.google.gson:gson:2.8.9 app.war
jbang --interactive app.war
jbang --runtime-option="-Xmx2g" --runtime-option="--enable-preview" myapp.java
jbang --compile-option="--enable-preview" --compile-option="-source 17" myapp.java
One can also override the main class on the command line by using `--main <name>` or `-m <name>`
`jbang -o` or `jbang --offline`. In this mode `jbang` will simply fail if dependencies have not been cached already.
simply use `--cds` to force it or `--no-cds` to turn it off no matter what the jbang script file contains.
"""
[[commands.field]]
id = "script"
label = "Script, jar or catalog alias"
description = "Path or URL of the script, a jar, a GAV coordinate or an alias."
type = "string"
position = 0
min = 1
sources = ["docs"]
[[commands.field]]
id = "args"
label = "Arguments for the script"
type = "string"
position = 1
multiple = true
sources = ["docs"]
[[commands.field]]
id = "deps"
label = "Extra dependencies"
description = "Maven coordinates (group:artifact:version), one per entry."
type = "string"
option = ["--deps"]
multiple = true
sources = ["docs"]
[[commands.field]]
id = "runtime_option"
label = "JVM options"
description = "Passed to the JVM when running the script, for example -Xmx2g."
type = "string"
option = ["--runtime-option"]
multiple = true
sources = ["docs"]
[[commands.field]]
id = "compile_option"
label = "Compiler options"
type = "string"
option = ["--compile-option"]
multiple = true
sources = ["docs"]
[[commands.field]]
id = "main"
label = "Main class"
type = "string"
option = ["--main", "-m"]
sources = ["docs"]
[[commands.field]]
id = "interactive"
label = "Interactive (jshell)"
description = "Explore the script and its dependencies in jshell."
type = "boolean"
option = ["--interactive"]
sources = ["docs"]
[[commands.field]]
id = "offline"
label = "Offline"
description = "Fail instead of downloading dependencies that are not cached."
type = "boolean"
option = ["--offline", "-o"]
sources = ["docs"]
[[commands.field]]
id = "cds"
label = "Class Data Sharing"
type = "boolean"
option = ["--cds"]
sources = ["docs"]
[[commands.task]]
id = "run"
label = "Run a script"
fields = ["script", "args", "deps", "runtime_option"]
required = ["script"]
[[commands.task]]
id = "repl"
label = "Explore in jshell"
fields = ["script", "deps", "interactive"]
required = ["script"]
set = { interactive = [true] }
[[commands.group]]
id = "basic"
label = "Basic"
fields = ["script", "args", "deps", "interactive"]
[[commands.group]]
id = "advanced"
label = "Advanced"
fields = ["runtime_option", "compile_option", "main", "offline", "cds"]