jpackage ROOTDIR variable in a Windows bat file
Alexey Semenyuk
alexey.semenyuk at oracle.com
Mon Nov 25 17:29:50 UTC 2019
On 11/23/2019 12:10 PM, Michael Hall wrote:
>
>> On Nov 23, 2019, at 10:51 AM, Kevin Rushforth <kevin.rushforth at oracle.com> wrote:
>>
>> $ROOTDIR is not a supported interface. You should use "$APPDIR" instead. Having said that, the real problem is likely your use of backslashes. I recommend using forward slashes and also enclosing it in single quotes, like this:
> It is apparently sometimes a unsupported interface. Since my OS X invocation works with…
> -Djava.security.policy=$ROOTDIR/app/all.policy
> I’ll have to change that to APPDIR to be sure it still works.
As Kevin pointed out, $ROOTDIR is a part of jpackage's internal interface.
However the problem problem you face is because you use backslashes
which a treated by jpackage as escape characters. This should work:
---
-Djava.security.policy=$ROOTDIR/app/all.policy
---
and this should work too:
---
-Djava.security.policy=$ROOTDIR\\app\\all.policy
---
On condition these strings don't go through any environment that does
its own escape characters processing.
>
> But this does show you should be correct for APPDIR being supported…
> JDK-8231910 Expose the APPDIR variable to applications that use jpackage
>
>> -Djava.security.policy='$APPDIR/all.policy'
>>
>> If you need to use backslashes for some reason, then you will need to use two (the first is treated as an escape character).
>>
> I thought java on Windows was pretty indifferent to forward or backslashes in file paths but I haven’t done much on Windows.
> I figured when in Rome or on Windows do what they do.
> First try keeping backslashes…
>
> Error: Invalid Option: [-Djava.security.policy=$APPDIR\app\all.policy]
>
> With forward slashes
>
> Error: Invalid Option: [-Djava.security.policy=$ROOTDIR/app/all.policy]
Hmm, I'm surprised of this error. What is the exact value of
—java-options parameter? As I side note, I'd recommend putting each java
option in a separate —java-options jpackage parameter. jpackage supports
multiple —java-options on command line.
- Alexey
More information about the core-libs-dev
mailing list