IntelliJ IDEA
 
Get IntelliJ IDEA
You are viewing the documentation for an earlier version of IntelliJ IDEA.

Run shebang scripts

Last modified: 11 February 2024

Starting with version 11, Java provides a way to run self-contained scripts without the need to compile them (https://openjdk.java.net/jeps/330). Furthermore, on Linux and macOS, you can make a Java script executable by specifying the JDK in the first line of the script.

This is called the shebang mechanism. Shebang support in Java comes in handy when you need to write an executable script, but cannot use a scripting language like bash or Python.