java
launches Java applications
TLDR
Run class file
$ java [ClassName]
Run JAR file$ java -jar [application.jar]
Run with classpath$ java -cp [path/to/classes] [ClassName]
Set heap size$ java -Xmx[512m] -jar [app.jar]
Run with system property$ java -D[property=value] [ClassName]
Show version$ java -version
Run single source file$ java [Source.java]
SYNOPSIS
java [options] class [args...]java [options] -jar jarfile [args...]
DESCRIPTION
java launches Java applications by loading and executing compiled bytecode in the Java Virtual Machine (JVM). It supports class files, JAR archives, and since Java 11, single source-file programs.The JVM handles memory management (garbage collection), threading, and platform abstraction. Memory is configured via -Xms (initial heap), -Xmx (max heap), and -Xss (stack size). System properties (-D) configure application behavior at runtime.
PARAMETERS
CLASS
Main class to execute.-jar FILE
Execute JAR file.-cp PATH
Class path for dependencies.-Xmx SIZE
Maximum heap size.-Xms SIZE
Initial heap size.-D PROP=VAL
Set system property.-Xss SIZE
Thread stack size.-ea, --enableassertions
Enable assertions.--enable-preview
Enable preview language features.-verbose :class|:gc|:jni
Enable verbose output.-version
Show version information.--help
Display help information.
CAVEATS
Requires JRE/JDK. Version compatibility matters. Memory settings may need tuning.
HISTORY
Java was created by James Gosling at Sun Microsystems in 1995. It's now maintained by Oracle and the OpenJDK community.
