Java disable dpi-aware not working

Fix for Windows, follow these steps: Create a windows regedit new DWORD Press Windows Button + R, type “regedit”, and then click OK. Navigate to the following registry subkey: HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows > CurrentVersion > SideBySide Right-click, select NEW > DWORD (32 bit) Value Type PreferExternalManifest, and then press ENTER. Right-click … Read more

Duplicated Java runtime options : what is the order of preference?

As always, check your local JVM’s specific implementation but here is a quick way to check from the command line without having to code. > java -version; java -Xmx1G -XX:+PrintFlagsFinal -Xmx2G 2>/dev/null | grep MaxHeapSize java version “1.8.0_25” Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) uintx MaxHeapSize … Read more

How to set -Dorg.apache.el.parser.COERCE_TO_ZERO=false programmatically

You can set the system properties programmatically using System#setProperty(). System.setProperty(“org.apache.el.parser.COERCE_TO_ZERO”, “false”); However, you need to ensure that this is been set before JSF/EL ever get initialized. Best place would be a ServletContextListener. public class Config implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent event) { System.setProperty(“org.apache.el.parser.COERCE_TO_ZERO”, “false”); } @Override public void contextDestroyed(ServletContextEvent event) { // NOOP … 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

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 🙂

Encourage the JVM to GC rather than grow the heap?

You could try specifying -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio to control heap expansion and shrinking: -XX:MinHeapFreeRatio – when the percentage of free space in a generation falls below this value the generation will be expanded to meet this percentage. Default is 40. -XX:MaxHeapFreeRatio – when the percentage of free space in a generation exceeded this value the … Read more