Skip to content

Impossible to pass JAVA_OPTIONS with spaces(?) #66

@karel1980

Description

@karel1980

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions