Skip to content
Latchkey

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.

java
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Xmx256m
[ERROR] Some script parsing 'java -version' output failed on the extra line

Common 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.

.github/workflows/ci.yml
# 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 -version

Stop scripts from breaking on the line

  1. Parse JVM output from stdout only, or filter the Picked up line, since it goes to stderr.
  2. Audit the injected flags so an unintended -Xmx/proxy is not affecting builds.
  3. 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →