Java Commands
JVM language, the JDK tools and runtime.All Java pages
- jar --create --main-class: create an executable JAR and run it with java -jarCreate an executable JAR with jar --create --file app.jar --main-class and run it with java -jar. Manifest Class-Path, no main manifest attribute, and jar cfe.
- java -cp: set the classpath with multiple JARs (lib/* wildcard)Set the Java classpath with several JARs: java -cp "out:lib/*" on Linux and macOS, a semicolon on Windows. How the lib/* wildcard works and why to quote it.
- java Hello.java: run a Java source file without javacSince Java 11, java Hello.java compiles one source file in memory and runs it, with no javac step and no .class file. Arguments, --source, and shebang use.
- javac -d out: compile multiple Java files with packages and run themCompile a Java program with several files and packages using javac -d out @sources.txt, then run it with java -cp out and the fully qualified class name.