RFR: JDK-8227641: java-options values with spaces are processed incorrectly

Roger Riggs Roger.Riggs at oracle.com
Fri Aug 9 13:25:36 UTC 2019

Hi Alexander,

I'm not sure we want to get into the business of telling people how use 
use shell quoting.
It does vary from shell to shell and on Windows vs. Linux.

I'd pick one simple example that works on Windows as well as Linux.

I would have thought that the example in the bug report would be handled 
since it should be delivered to java intact as a single argument. 
('-Dfoo=foo bar')


On 8/9/19 12:26 AM, Alexander Matveev wrote:
> Please review the jpackage fix for bug [1] at [2].
> This is a fix for the JDK-8200758-branch branch of the open sandbox 
> repository (jpackage).
> - There are no know bugs in how we handle java options with spaces. 
> However, it might be complicated to figure out how to provide such 
> options. Added several examples to help to show most common cases.
>   --java-options <java options>
>           Options to pass to the Java runtime
>           This option can be used multiple times.
>           Example 1: To specify [-DOption1=My Great App] use
>            [--java-options "-DOption1=\"My Great App\""]
>           Example 2: To specify [-DOption2="My Great App in quotes"] use
>            [--java-options "-DOption2=\"\\\"My Great App in 
> quotes\\\"\""]
>           Example 3: To specify [-DOption3=Value "with" quotes] use
>            [--java-options "-DOption3=\"Value \\\"with\\\" quotes\""]
> Application will read them back as:
> -DOption1=My Great App
> -DOption2="My Great App in quotes"
> -DOption3=Value "with" quotes
> [1] https://bugs.openjdk.java.net/browse/JDK-8227641
> [2] http://cr.openjdk.java.net/~almatvee/8227641/webrev.00/
> Thanks,
> Alexander

More information about the core-libs-dev mailing list