Information About _Java_Options

Difference between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS and JAVA_OPTS

You have pretty much nailed it except that these options are picked up even if you start JVM in-process via a library call.

The fact that _JAVA_OPTIONS is not documented suggests that it is not recommended to use this variable, and I've actually seen people abuse it by setting it in their ~/.bashrc. However, if you want to get to the bottom of this problem, you can check the source of Oracle HotSpot VM (e.g. in OpenJDK7).

You should also remember that there is no guarantee other VMs have or will continue to have support for undocumented variables.

UPDATE 2015-08-04: To save five minutes for folks coming from search engines, _JAVA_OPTIONS trumps command-line arguments, which in turn trump JAVA_TOOL_OPTIONS.

Java System Environment Variable

There is a special environment variable called _JAVA_OPTIONS, its value will be picked up by the JVM (java.exe).

In Windows:

set _JAVA_OPTIONS=-Xms64m -Xmx128m -Dawt.useSystemAAFontSettings=lcd

In Linux:

export _JAVA_OPTIONS='-Xms64m -Xmx128m -Dawt.useSystemAAFontSettings=lcd'

For Java Web Start it's JAVAWS_VM_ARGS. For javaw.exe (Applet), it's _JPI_VM_OPTIONS.


edit 20201213

_JAVA_OPTIONS environment variable was ok but was not documented or supported.

Since it is not standardized, other vendors have their own names e.g. IBM_JAVA_OPTIONS. Leading underscore names are private by convention so it's not a good idea to standardize the usage of _JAVA_OPTIONS.

That's why JAVA_TOOL_OPTIONS should be the preferred choice.

ref : https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#tooloptions

Picked up _JAVA_OPTIONS in kali linux

This is not warning, it is information.

It literally says that some settings were picked up from _JAVA_OPTIONS environmental variable. It is used to configure some switches "globally" for every java application that will be run in given environment. You must have this set either on system or user level. If you remove that variable, information will be gone.

What is meaning when _JAVA_OPTIONS system variable value is given -Xmx512M?

See What are the Xms and Xmx parameters when starting JVMs?.
mx specifies the maximum memory for your java process. It's weird that java didn't start with the default value, usually it happens if you set it to something too big for the physical memory of your machine.

Picked up _JAVA_OPTIONS: -Xmx512M

try to use

JAVA_OPTIONS="-Djava.io.tmpdir=$HOME/tmp"

in your bash shell.

Alternatively, if you're using Windows, you may have encounter _JAVA_OPTIONS variables for both User&System Environment variables. If so, delete each of them, and recall netbeans.



Related Topics



Leave a reply



Submit