Run Java files from the terminal - no IDE required. Source: github.com/llerandi/java-runner
No IDE, no build system, no project structure. Point it at a .java file and it handles the rest.
Wraps javac and java into one step. Compiles, runs, prints output, and cleans up.
Reruns automatically every time you save the file. Uses inotifywait on Linux, fswatch on macOS, FileSystemWatcher on PowerShell, and timestamp polling on Windows CMD.
No argument needed if there is only one .java file in the directory. Falls back to examples/ automatically.
Strips absolute path noise from compiler errors so they are shorter and easier to read.
Shows how long the program took to run after every execution, in milliseconds.
runner.sh for Linux and macOS. runner.bat for Windows CMD. runner.ps1 for PowerShell with event-based watch mode.
Requires Java JDK 11 or higher. No other dependencies for the basic run.
For watch mode on Linux, install inotify-tools:
For watch mode on macOS, install fswatch:
On Windows CMD use runner.bat with the same flags. On PowerShell use .\runner.ps1 with -Watch, -All, -InputFile, -OutputFile, -Classpath.
| Tool | Purpose | Notes |
|---|---|---|
| Java JDK | Compile and run | Version 11+. Must include javac. Not just the JRE. |
| Bash 3.2+ | Run runner.sh |
Linux and macOS only. |
| inotify-tools | Watch mode on Linux | sudo apt install inotify-tools |
| fswatch | Watch mode on macOS | brew install fswatch |
Windows CMD users need no extra tools. Watch mode polls the file timestamp every 2 seconds. PowerShell users get event-based watch mode via runner.ps1 with no extra dependencies.
Successful run:
Compilation error:
Once you are comfortable running Java files, use java-kata-judge to validate your solutions with automated JUnit 5 tests - no Maven, no Gradle, no IDE required.