Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK_JAVA_OPTIONS picked up twice #153

Open
irigarae opened this issue Jan 31, 2022 · 2 comments
Open

JDK_JAVA_OPTIONS picked up twice #153

irigarae opened this issue Jan 31, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@irigarae
Copy link

When using the JDK_JAVA_OPTIONS environment variable it's picked up twice.

$ echo 'public class Test { public static void main(String[] args) { System.out.println("Should pick once"); } }' > Test.java
$ docker run --rm -it -v $(pwd)/Test.java:/Test.java:Z -e JDK_JAVA_OPTIONS="-Dsomehow=duplicated" eclipse-temurin:17.0.1_12-jdk-alpine java Test.java
NOTE: Picked up JDK_JAVA_OPTIONS: -Dsomehow=duplicated
NOTE: Picked up JDK_JAVA_OPTIONS: -Dsomehow=duplicated
Should pick once

Visible also by running an app in the background and doing

$ jps -lvm
6 jdk.compiler/com.sun.tools.javac.launcher.Main Test.java -Dsomehow=duplicated -Dsomehow=duplicated --add-modules=ALL-DEFAULT

Also visible from JMX.

@karianna karianna added the bug Something isn't working label Jan 31, 2022
@zdtsw
Copy link
Contributor

zdtsw commented Oct 5, 2022

duplicated as in adoptium/adoptium-support#303 ?

@gdams
Copy link
Member

gdams commented Oct 29, 2024

i think this is because we set JAVA_TOOL_OPTIONS in our entrypoint.sh:

export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS} -Djavax.net.ssl.trustStore=${JRE_CACERTS_PATH} -Djavax.net.ssl.trustStorePassword=changeit"

Running your test with JAVA_TOOL_OPTIONS instead of JDK_JAVA_OPTIONS seems to prevent this from happening:

docker run --rm -it -v $(pwd)/Test.java:/Test.java:Z -e JAVA_TOOL_OPTIONS="-Dsomehow=duplicated" eclipse-temurin:17-jdk-alpine java Test.java

Picked up JAVA_TOOL_OPTIONS: -Dsomehow=duplicated
Should pick once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants