-
Notifications
You must be signed in to change notification settings - Fork 137
Description
Linux Startup Script Does Not Quote Application Arguments
Description:
In the current version of JavaPackager (v1.7.9
), the generated Bash startup script for Linux does not properly quote application arguments. As a result, quoted argument lists are incorrectly split into multiple arguments when passed to the Java application, rather than being preserved as a single argument.
Affected Version:
Confirmed in v1.7.9
Steps to Reproduce:
- Write a Java app that prints the
String[] args
to the console. - Build the app for Linux using JavaPackager.
- Run the app from the console with quoted arguments.
Expected Behavior:
Quoted arguments (e.g., "arg with spaces"
) should be one single element in the Java application's string array.
Actual Behavior:
Arguments are split at spaces, even within quoted strings, causing incorrect handling within the application's argument string array.
Suggested Fix
Update the script to properly preserve quoted arguments by using "$@"
instead of $@
. This ensures each argument is passed exactly as intended.
Modify the following lines in linux/startup.sh.vtl
(around lines 84–88):
#if ($info.administratorRequired)
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY GDKBACKEND=x11 "${JAVA}" ${JVMDefaultOptions} -jar "${JVMClassPath}" "$@"
#else
"${JAVA}" ${JVMDefaultOptions} -jar "${JVMClassPath}" "$@"
#end