I have a java process and I'm trying to append multiple parameters to it loaded from an environment variable in a bash file. Example:
export JAVA_OPTS="-Dparam.one.name=value_one -Dparam.two.name=value_two"
#not working:
java \
"${JAVA_OPTS}" \
-jar cookie.jar
#working:
java \
-Dparam.one.name=value_one \
-Dparam.two.name=value_two \
-jar cookie.jar
Is there a way to get around this? Is this a formatting problem? The idea behind this is that I don't want to change the script if I want to use some other/new parameter, I only want to change the environment variable.
Maybe it would work if I put everything in one line, but that would make the actual command extremely long, so that is not an optimal solution.
Also the same thing is working perfectly with one property.
I really appreciate other approaches as well.