When should each of these environment variables be used?
2 Answers
JAVA_TOOL_OPTIONS is read by some JDK tools, but has limited applicability.
JAVA_OPTS is a convention used by Apache Tomcat and some other apps, but is not
read directly by any JDK tools published by Sun/Oracle, AFAIK.
From: https://forums.oracle.com/forums/thread.jspa?messageID=6438415
JAVA_OPTS is not an environment variable that the java executable will recognize on it's own. Instead, various scripts which wrap the start up of java will often use an environment variable named JAVA_OPTS to configure the java executable (for example, the tomcat startup script does this).
Comments
see "what is" doc and "tool options" doc
Basically, the JAVA_TOOL_OPTIONS is intended for use by development tools, monitoring tools and the like whereas JAVA_OPTS is used for running 'general' Java programs, I think people tend to mix and match somewhat (from what Google has shown me example wise).
3 Comments
Picked up JAVA_TOOL_OPTIONS: -XX:+UseG1GC -Xmx4G.