Java "Picked up JAVA_TOOL_OPTIONS" Warning in CI - Quiet or Fix It
The JVM prints Picked up JAVA_TOOL_OPTIONS: ... to stderr whenever that env var is set, applying its flags to every JVM. It is informational, but it can inject memory/proxy flags you did not intend, or pollute output that another tool parses.
What this error means
Every Java/Maven/Gradle invocation prints Picked up JAVA_TOOL_OPTIONS: -Xmx512m ... (or _JAVA_OPTIONS/JDK_JAVA_OPTIONS). Some scripts that capture JVM stdout break because the line appears unexpectedly, or builds get unexpected heap/proxy settings.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Xmx256m
[ERROR] Some script parsing 'java -version' output failed on the extra lineCommon causes
JAVA_TOOL_OPTIONS set in the environment
A base image, setup action, or org-wide env sets JAVA_TOOL_OPTIONS. The JVM honors it globally and announces it on stderr each launch.
Unintended flags applied to every JVM
A too-small -Xmx or a stale proxy in JAVA_TOOL_OPTIONS silently affects builds and tests, sometimes causing OOM or network failures elsewhere.
How to fix it
Set the value intentionally or clear it
Decide what belongs in JAVA_TOOL_OPTIONS; unset it for steps that must not inherit flags.
# Use it deliberately for all JVMs in the job:
env:
JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
# Or clear it for a step that parses JVM output:
- run: JAVA_TOOL_OPTIONS= java -versionStop scripts from breaking on the line
- Parse JVM output from stdout only, or filter the
Picked upline, since it goes to stderr. - Audit the injected flags so an unintended
-Xmx/proxy is not affecting builds. - Prefer explicit per-tool memory settings (MAVEN_OPTS/GRADLE_OPTS) over a global JAVA_TOOL_OPTIONS.
How to prevent it
- Set JAVA_TOOL_OPTIONS deliberately and minimally, prefer tool-specific options vars, and make output-parsing scripts read stdout only.