Java 25 introduces source-file mode that lets you run a single Java file as an executable script without compilation or build tools. By adding a shebang line (#!/usr/bin/env -S java --source 25), an instance void main() method using IO.println(), and making the file executable, you can create a system-wide runnable script in just 4 lines — no .java extension required.
Sort: