Java Flags & Options
JVM language, the JDK tools and runtime.All Java pages
- java -Dname=value: set a system property on the command linejava -Dname=value sets a Java system property read with System.getProperty. Placement before the class, quoting, JAVA_TOOL_OPTIONS and the space after -D.
- java -Xmx: set the maximum heap size (and fix OutOfMemoryError: Java heap space)java -Xmx sets the maximum Java heap size and fixes OutOfMemoryError: Java heap space. Units, the default 1/4 of RAM, -Xms, MaxRAMPercentage, where to set it.
- javac --release 8|11|17: compile for an older Java version (vs -source/-target)javac --release 8, 11 or 17 compiles for an older Java version and checks the API too, unlike -source/-target. Class file versions and Maven/Gradle settings.
- javac -Xlint: show all compiler warnings (unchecked, deprecation, rawtypes)javac -Xlint shows all Java compiler warnings: unchecked, rawtypes, deprecation, removal, fallthrough. Keys, -Werror, @SuppressWarnings and build tool setup.