jpackage: support for environment variables in --java-options

Andy Herrick andy.herrick at oracle.com
Tue Sep 1 15:30:46 UTC 2020


I have been following this discussion , and feel it is worth pursuing.

Currently , the values of --arguments and --java-options are 
pre-processed at launch time by expanding the values of $APPDIR, 
$ROOTDIR, and $BINDIR to values determined by the native launchers.

If we can do so without breaking existing functionality we should also 
expand  environment variables to their values at launch time.

example:  "--java-options \$USER_JAVA_OPTIONS", "--java-options 
-Dfoo=\$USER_BAR_VALUE",  "--arguments \$USER_MYAPP_ARGS"

Developer would have to make sure that the resulting java options or app 
arguments make sense both with and without the corresponding environment 
variable set.  jpackage could make sure that an empty option or argument 
did not cause a problem (as in first and third example above when there 
is no corresponding env setting).

/Andy


On 9/1/2020 10:23 AM, Michael Hall wrote:
>
>> On Sep 1, 2020, at 2:07 AM, Serban Iordache <serban.iordache at gmail.com> wrote:
>>
>> Not sure if it was clear from my previous messages, but what I am asking for is that the environment variables are expanded with the values they have on the user's machine (not on the machine where jpackage has been executed).
> It might be better at this point for the developers to respond.
>
> However, I believe on probably all platforms these options are included in a .cfg file that is bundled with the application. It is set at build time and not in anyway dynamic at runtime. Unless maybe you had some pre-launch process that modified that .cfg file?
>
> On OS X I believe true application environment variables can be set in the Info.plist file, LSEnvironment entries if I remember correctly. A fork of the javapackager tool previously used in association with JavaFX was recently.mentioned on that list (JavaFX). I saw it included support for the PATH environment variable. On OS X using LSEnvironment as mentioned. I didn’t see this on the jpackage —help and wondered if any such support was currently included in jpackage.
>
> It is a valid point I was overlooking that some of this might be user dependent and changes to PATH or other environment variables might not be valid for all users unless care was taken. Again, difficult to take care with everything set at build time.
>
>
>
>   
>


More information about the core-libs-dev mailing list