# jbang — run Java like a script Companion module for the ankurm.com post **JBang: Run Java Like a Script in 2026**. Everything the post explains lives in this directory; every console block in the post is quoted from a file in [`output/`](output/), regenerated by one command. ## Versions tested | Component | Version | Note | |---|---|---| | JDK | Temurin 25.0.5.1 (LTS) | compact source files (JEP 512) are final in 25 | | JBang | 0.132.1 | latest jar published to Maven Central; GitHub's newest stable is v0.143.0 (not run here) | | picocli | 4.7.7 | | | Jackson | 3.3.0 (`tools.jackson`) | | | Spring Boot | 4.2.0 (`spring-boot-starter-webmvc`) | Tomcat 11.0.27 | | GraalVM | Oracle GraalVM 25.0.4 | `native-image` for the `--native` step | ## Layout | File | What it demonstrates | |---|---| | `Hello.java` | the smallest script; shebang line; cold vs warm start | | `CompactHello.java` | a compact source file (`void main()`), no class | | `Greeter.java` | `//DEPS` + picocli: a real CLI with `--help` | | `Pretty.java` | Jackson 3 JSON pretty-printer reading stdin | | `multi/` | `//SOURCES` and `//FILES` | | `SpringApp.java` | a whole Spring Boot web app in one file (BOM via `@pom`) | | `broken/` | four failures, kept outside the happy path on purpose | | `templates/tool.java.qute` + `jbang-catalog.json` | a custom `jbang init` template and aliases | | `scripts/jb.sh` | runs JBang (real launcher if installed, otherwise the Maven Central jar) | | `scripts/run-all.sh` | regenerates every file in `output/` | ## Run it ```bash export JAVA_HOME=/path/to/jdk-25 PATH=$JAVA_HOME/bin:$PATH jbang Hello.java Ankur jbang Greeter.java --help jbang SpringApp.java # then: curl localhost:8089/hello ./scripts/run-all.sh # rebuild output/*.txt ``` No `docs/` folder on purpose: the explanation is in the blog post.