What is the difference between JDK_JAVA_OPTIONS and JAVA_TOOL_OPTIONS when using Java 11?

JDK_JAVA_OPTIONS is only picked up by the java launcher, so use it for options that you only want to apply (or only make sense for) the java startup command. This variable is also new on JDK 9+, and will be ignored by earlier JDK versions. Hence, it’s useful when migrating from older versions to 9+. … Read more

How to set a java system property so that it is effective whenever I start JVM without adding it to the command line arguments

You can set set environment variable JAVA_TOOL_OPTIONS in your OS. All Java tools (java, javac, ..) will pick this variable up and use it. So you could e.g. use SET JAVA_TOOL_OPTIONS=-Dsun.locale.formatasdefault=true I use this to force a specific locale for each JVM. But this only works if your application is started through the Java tools. … Read more

What is the benefit of setting java.awt.headless=true?

There is no performance benefit of setting java.awt.headless=true if you’re not using AWT features. AWT features are loaded on-demand. As explained in the linked article, headless mode is useful for accessing some Java graphics features which are normally delegated to the graphics host: After setting up headless mode and creating an instance of the headless … Read more

Default values for Xmx, Xms, MaxPermSize on non-server-class machines

Default values for JDK 1.6.0_29 on Windows 7/32-bit: -Xmx256m -XX:MaxPermSize=64m Also value of these option can be printed by following command: java -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version 2>&1 Then look for MaxHeapSize and MaxPermSize keys and see default values. uintx InitialHeapSize := 199947456 {product} uintx MaxHeapSize := 268435456 {product} uintx MaxPermSize = 67108864 {pd product} Here … Read more

How can I disable IPv6 stack use for IPv4 IPs on JRE?

I wanted to use this for some program I hadn’t control for running that Java app so ended with this _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true environment variable. (read about _JAVA_OPTIONS here) If you are using Windows, just run this command on Windows cmd: setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true Thanks to Jason Nichols for reminding this JVM argument 🙂

How to give more memory to IntelliJ Idea 9-11

On Mac, $IDEA_HOME/Contents/Info.plist ~: grep –context=5 Xmx /Applications/Maia-IU-94.426.app/Contents/Info.plist <string>true</string> <key>apple.awt.fullscreencapturealldisplays</key> <string>false</string> </dict> <key>VMOptions</key> <string>-Xms128m -Xmx912m -Dfile.encoding=UTF-8 -XX:MaxPermSize=250m -ea -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=IntelliJIdea90 -Xbootclasspath/a:../lib/boot.jar</string> <key>WorkingDirectory</key> <string>$APP_PACKAGE/bin</string> </dict> </dict> </plist> On Windows/Linux, %IDEA_HOME%\bin\idea.vmoptions