jpackage: spaces in --java-options

Andy Herrick andy.herrick at oracle.com
Fri Jul 12 17:21:38 UTC 2019


I can reproduce this problem and have created JDK-8227641 
<https://bugs.openjdk.java.net/browse/JDK-8227641> to address it.

/Andy


On 7/12/2019 3:53 AM, Serban Iordache wrote:
> Currently, there is no easy way to pass system properties containing spaces
> to the Java runtime.
>
> For example, if we execute jpackage with:
> --java-options -Dlabel="my great app"
>
> The resulting configuration file will contain:
> [JavaOptions]
> -Dlabel=my
> great
> app
>
>
> instead of the desired:
> [JavaOptions]
> -Dlabel=my great app
>
>
> Looking at the regexp used by jdk.jpackage.internal.Arguments, I came up
> with a workaround: surrounding the spaces with \"
> This means that executing jpackage with:
> --java-options -Dlabel="my\" \"great\" \"app"
>
> will produce the desired output in the configuration file:
> [JavaOptions]
> -Dlabel=my great app
>
>
> But this is an ugly hack. It would be nice to have a better way to handle
> JVM options containing spaces.
>
>
> Another issue is related to passing JVM options containing simple or double
> quotes. For example, I couldn't find a way to make jpackage generate a
> configuration file that contains:
> [JavaOptions]
> -Dlabel=my "great" app
>
>
> Best regards,
> Serban Iordache


More information about the core-libs-dev mailing list