Java
JDK tools and runtime commands. Compile, run, package, and debug Java applications from the command line.
45 commands
Browse by Topic
Install Java (macOS)
Install OpenJDK using Homebrew on macOS
Check Java version
Display the installed Java runtime version
Compile a Java file
Compile a Java source file into bytecode
Compile Java file
Compile a single Java source file.
Compile with classpath
Compile with external JARs in the classpath.
Compile to output directory
Compile sources and output class files to a directory.
Compile with all warnings
Enable all compiler warnings for better code quality.
Compile for specific version
Compile targeting a specific Java version.
Compile with debugging info
Include debugging information in class files.
Compile module
Compile Java modules from source path.
Show deprecation warnings
Show detailed deprecation warnings during compilation.
Run Java class
Run a compiled Java class with main method.
Run with classpath
Run with specified classpath including JARs.
Set heap memory
Set initial (512MB) and max (4GB) heap memory.
Use G1 garbage collector
Run with G1 garbage collector for balanced performance.
Enable heap dump on OOM
Automatically create heap dump when OutOfMemoryError occurs.
Set system property
Pass system property to the application.
Enable GC logging
Log garbage collection events to file (Java 9+).
Run single-file source
Compile and run single-file program directly (Java 11+).
Use ZGC collector
Use ZGC for low-latency large heap applications.
Create JAR file
Create a JAR from compiled classes directory.
Create executable JAR
Create JAR with entry point for direct execution.
Run JAR file
Execute a JAR file with Main-Class manifest entry.
Extract JAR contents
Extract all contents from a JAR file.
List JAR contents
List all files contained in a JAR.
View manifest
Display the manifest file from a JAR.
Update JAR contents
Add or update files in an existing JAR.
Describe module JAR
Show module descriptor information for a modular JAR.
Create runtime image (jlink)
Create custom minimal JRE with only required modules.
Optimized runtime image
Create minimal runtime with optimizations (~25MB).
Create native installer (jpackage)
Create native installer (.msi, .dmg, .deb) for distribution.
Generate Javadoc
Generate HTML API documentation from source code.
List trusted CA certs
List all trusted CA certificates in the JDK keystore.
Generate keystore
Generate a new key pair and self-signed certificate.
Analyze dependencies (jdeps)
Analyze class and package dependencies of a JAR.
List JDK modules
Display all modules available in the JDK.
List Java processes
List all running Java processes with full details.
Get JVM flags
Display all JVM flags including defaults for a process.
Thread dump
Generate thread dump to analyze deadlocks and thread states.
Heap dump
Create heap dump for memory analysis.
Monitor GC activity
Display GC statistics every second.
Start flight recording
Start Java Flight Recorder for low-overhead profiling.
Heap histogram
Show memory usage by class (live object counts).
Force garbage collection
Trigger full garbage collection (use sparingly).
Native memory tracking
Show native memory usage (requires -XX:NativeMemoryTracking=summary).
Discussion
Loading comments...