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.

Answer from mkalkov on Stack Overflow
🌐
ProgrammerZero Blog
programmerzero.hashnode.dev › javaopts-vs-javaoptions-vs-javatooloptions-whats-the-difference
Java ENV Variables: Key Differences - ProgrammerZero Blog
December 9, 2024 - If a script uses JAVA_OPTS, it appends its value to the JVM options for that particular application. Who is this guy?: A tool-specific variable that works with certain Java-based tools like Oracle WebLogic or IBM WebSphere.
🌐
GitHub
github.com › travis-ci › travis-cookbooks › issues › 895
Use JAVA_TOOL_OPTIONS instead of _JAVA_OPTIONS · Issue #895 · travis-ci/travis-cookbooks
August 31, 2017 - In #885 we introduced _JAVA_OPTIONS in an attempt to control JVM memory allocation. Documentation suggests that JAVA_TOOL_OPTIONS is actually recommended for these cases. The difference is pretty n...
Author   travis-ci
🌐
Baeldung
baeldung.com › home › java › core java › what is the difference between jdk_java_options and java_tool_options?
What Is the Difference Between JDK_JAVA_OPTIONS and JAVA_TOOL_OPTIONS? | Baeldung
February 28, 2025 - We often need to pass JVM options without modifying our scripts when configuring Java applications. Instead of manually adding flags every time we run the java command, we can use the environment variables JDK_JAVA_OPTIONS or JAVA_TOOL_OPTIONS.
🌐
Codemia
codemia.io › home › knowledge hub › difference between _java_options, java_tool_options and java_opts
Difference between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS and JAVA_OPTS | Codemia
January 27, 2025 - JAVA_TOOL_OPTIONS is the spec-compliant, portable choice. It is prepended to the command line, so explicit CLI arguments override it. Use this as your default. _JAVA_OPTIONS is HotSpot-specific and appended to the command line, meaning it overrides explicit CLI arguments.
🌐
Metabase
discourse.metabase.com › get help
JVM env var on Docker: JAVA_TOOL_OPTIONS or JAVA_OPTS? - Get Help - Metabase Discussion
October 5, 2022 - Hello, I have a deployment using the official Docker image (metabase/metabase) and I'm a bit confused about which environment variable I should use to control JVM options. I see different references to JAVA_TOOL_OPTIONS and to JAVA_OPTS. My final goal is to pass something like -Xmx8g to it.
🌐
Java Code Geeks
javacodegeeks.com › home
JDK_JAVA_OPTIONS vs JAVA_TOOL_OPTIONS - Java Code Geeks
March 19, 2025 - Here are the key differences between JDK_JAVA_OPTIONS and JAVA_TOOL_OPTIONS based on the exercises outlined in step 2 and step 3: ... Recommend using JDK_JAVA_OPTIONS for JDK 9+ with stricter JVM option enforcement. If any of the options is invalid for any Java processes, then don’t include it as these JVM options apply to all the Java processes in that environment.
🌐
javaspring
javaspring.net › blog › difference-between-java-options-java-tool-options-and-java-opts
Difference Between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS, and JAVA_OPTS: JVM Environment Variables Explained — javaspring.net
Without such a script, JAVA_OPTS has no effect. Non-standard: Not defined by the JVM specification; behavior depends on the script. Tool-specific: Only affects the java launcher (and only if the script forwards it). No built-in precedence: Options in JAVA_OPTS are treated like command-line arguments, so they can be overridden by explicit command-line options.
Find elsewhere
🌐
DEV Community
dev.to › sunnybhambhani › different-environment-variables-available-in-java-101o
Different environment variables available in Java - DEV Community
January 3, 2026 - JAVA_OPTS: >JAVA_OPTS is not an environment variable that the java executable will recognise on its own.
🌐
CodingTechRoom
codingtechroom.com › question › difference-between-java-opts-and-java-tool-options
What is the Difference Between JAVA_OPTS and JAVA_TOOL_OPTIONS? - CodingTechRoom
JAVA_OPTS is specifically used to define options for the Java application being launched. JAVA_TOOL_OPTIONS applies globally and can affect all Java applications executed in the current environment.
🌐
Iditect
iditect.com › faq › java › difference-between-javaoptions-javatooloptions-and-javaopts.html
Difference between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS and JAVA_OPTS
_JAVA_OPTIONS and JAVA_TOOL_OPTIONS are more focused on setting default JVM options and are system-wide settings. JAVA_OPTS is commonly used in the context of application servers and servlet containers to configure Java options specifically for applications deployed within that container.
🌐
Javaallin
javaallin.com › code › difference-between-java-options-java-tool-options-and-java-opts.html
Difference between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS and JAVA_OPTS
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_OPTS is included for completeness. It is not part of the JVM, but there is a lot of questions about it out in the wild.
🌐
Stack Overflow
stackoverflow.com › questions › linked › 2011311
Hot Linked Questions - Stack Overflow
I have a Spring Boot app, containerized, running in Docker Cloud, with the following JAVA_OPTS: -Xmx512m -XX:+UseConcMarkSweepGC -XX:NativeMemoryTracking=summary -Djava.rmi.server.hostname=127.0.0.1 ...
🌐
Devgex
devgex.com › en › article › 00039899
Comprehensive Analysis of _JAVA_OPTIONS, JAVA_TOOL_OPTIONS, and JAVA_OPTS: Roles and Differences in JVM Parameter Configuration - DevGex
December 4, 2025 - Abstract: This paper systematically examines the operational mechanisms and core distinctions among three environment variables—_JAVA_OPTIONS, JAVA_TOOL_OPTIONS, and JAVA_OPTS—in Java Virtual Machine parameter configuration.
🌐
Learn IT University
learn-it-university.com › home › understanding the distinction between java_opts and java_tool_options
Understanding the Distinction between JAVA_OPTS and JAVA_TOOL_OPTIONS - Learn IT University
July 8, 2024 - It allows developers to set various ... optimally. ... In contrast, CUSTOM_TOOL_OPTIONS is specifically dedicated to development and monitoring tools that require specific configurations....
🌐
DEV Community
dev.to › azure › a-better-way-to-tune-the-jvm-in-dockerfiles-and-kubernetes-manifests-329c
A Better Way to Tune the JVM in Dockerfiles and Kubernetes Manifests - DEV Community
September 12, 2025 - JDK_JAVA_OPTIONS is an environment variable that the JVM reads automatically. Whatever you put there gets appended to the command line of every JDK tool (java, javac, jshell, etc.)
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › guides › troubleshoot › envvars002.html
The JAVA_TOOL_OPTIONS Environment Variable
April 21, 2026 - When this environment variable is set, the JNI_CreateJavaVM function (in the JNI Invocation API) prepends the value of the environment variable to the options supplied in its JavaVMInitArgs argument. This environment variable allows you to specify the initialization of tools, specifically the launching of native or Java programming language agents using the -agentlib or -javaagent options.
🌐
Blogger
thompsonng.blogspot.com › 2016 › 08 › java-javaoptions-and-javatooloptions.html
JAVA - _JAVA_OPTIONS and JAVA_TOOL_OPTIONS environment variable
August 9, 2016 - JAVA_TOOL_OPTIONS is platform independent. Reference: 1. JAVA_TOOLS_OPTIONS 2. IBM_JAVA_OPTIONS 3. http://stackoverflow.com/questions/28327620/difference-between-java-options-java-tool-options-and-java-opts
🌐
CodingTechRoom
codingtechroom.com › question › understanding-the-differences-between-java-options-java-tool-options-and-java-opts
What Are the Differences Between _JAVA_OPTIONS, JAVA_TOOL_OPTIONS, and JAVA_OPTS? - CodingTechRoom
JAVA_TOOL_OPTIONS is used to specify options for Java executables in environments where command-line access is restricted. JAVA_OPTS is a non-standard variable used primarily by certain application servers and scripts.