Source file
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script
Source reference
arguments=(-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar "$jarfile" $RUN_ARGS "$@")
Branch
All branches
Problem
-Dkey=value
Value does not allow spaces ?
Resolve
Use an additional array variable ( e.g. X_JAVA_OPTS ) to join with arguments
This way, the value can be allowed to contain spaces.
Thanks
Comment From: github-edu
arguments array elements allow spaces, so join e.g. -Dxxx.path=/home/us/app 3.0/lib to arguments is ok !!!
e.g.
arguments=(-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS "-Dxxx.path=/home/us/app 3.0/lib" -jar "$jarfile" $RUN_ARGS "$@")
Comment From: github-edu
e.g.
[[ -f "$PID_FOLDER"/vm.options ]] && source "$PID_FOLDER"/vm.options
if [ -n "$X_JAVA_OPTS" ]; then
arguments=(-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS ${X_JAVA_OPTS[@]} -jar "$jarfile" $RUN_ARGS "$@")
else
arguments=(-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar "$jarfile" $RUN_ARGS "$@")
fi
before start
declare -p X_JAVA_OPTS > "$PID_FOLDER"/vm.options
Comment From: wilkinsona
Thanks for the report. Unfortunately, handling of spaces in the launch scripts isn't as good as we'd like, but we've yet to identify a way to fix it that's backwards compatible and that we're happy with. Please see https://github.com/spring-projects/spring-boot/issues/19716 and https://github.com/spring-projects/spring-boot/issues/18540 for details. Until those issues are addressed, please use a custom launch script that meets your specific needs.
Comment From: github-edu
Thank you so much !