Java, Maven and Gradle 25 · Compile and run
Check the Java version
Print the installed JDK version.
java --version
Official Java, Maven and Gradle 25 documentation
More compile and run commands
- Compile a source file
- Run a compiled class
- Run a single source file directly
- Run a jar
- Run with a classpath
- Set the maximum heap size
All compile and run commands · Java, Maven and Gradle 25 cheatsheet