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

Impossible to pass JAVA_OPTIONS with spaces(?) #66

Open
karel1980 opened this issue Nov 27, 2020 · 1 comment
Open

Impossible to pass JAVA_OPTIONS with spaces(?) #66

karel1980 opened this issue Nov 27, 2020 · 1 comment

Comments

@karel1980
Copy link

I'm trying to run java -Dfoo="one two three" but I didn't manage to find the right combination of quotes or escapes to make this work

Given:
docker run -e JAVA_MAIN_CLASS=Main -e JAVA_OPTIONS="-Dfoo=one two three" -i -t fabric8/java-alpine-openjdk8-jdk:1.8.0 /deployments/run-java.sh

Actual output:
exec java -Dfoo=one two three -javaagent:/opt/agent-bond/agent-bond.jar=jolokia{{host=0.0.0.0}},jmx_exporter{{9779:/opt/agent-bond/jmx_exporter_config.yml}} -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:+ExitOnOutOfMemoryError -cp .:/deployments/* Main
Error: Could not find or load main class two

Expected output:
...
Error: Could not find or load main class Main

I tried to add backslashes and quotes in various combinations, but I never got it right.
I suspect it has something to do with the 'normalize spaces' stuff in java_options of /deployments/run-java.sh

@karel1980
Copy link
Author

karel1980 commented Nov 27, 2020

I should add that spaces should not be normalised too aggressively:

If a user wants to pass -Dfoo="one <multiple spaces> two <multiple spaces> three" then the spaces should not be stripped.
(Had to do this edit this a few times because markdown is aggressively removing spaces. How ironic)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant