Information about _JAVA_OPTIONS

Java

Java Problem Overview


Can anyone explain what does Java do when _JAVA_OPTIONS Environment variable defined & when application launched on the windows machine?

Java Solutions


Solution 1 - Java

You can use _JAVA_OPTIONS to pass options to any JVM process started on your system.

For example,

set _JAVA_OPTIONS=-Dsun.java2d.noddraw=true

When a JVM starts, it parses the value of _JAVA_OPTIONS as if the parameters were at the command line of java. You can see the passed parameters via JVisualVM.

For more information, read the blog post: What I discovered while trying to pass Default JVM Parameters

Solution 2 - Java

And according to https://bugs.openjdk.java.net/browse/JDK-4971166 undocumented Hotspot-specific _JAVA_OPTIONS was superseded by JAVA_TOOL_OPTIONS that is included in standard JVMTI specification, does better handling of quoted spaces and should be always preferred.


Since JDK 9+ there's also JDK_JAVA_OPTIONS as the preferred replacement, see https://stackoverflow.com/q/52986487/537554

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMadanView Question on Stackoverflow
Solution 1 - JavaDemi Ben-AriView Answer on Stackoverflow
Solution 2 - JavaVadzimView Answer on Stackoverflow