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

Serban Iordache serban.iordache at gmail.com
Tue Sep 1 06:37:26 UTC 2020


Thanks, Michael!

I maintain two Gradle plugins that help creating custom images and packages
with jlink and jpackage (https://github.com/beryx/badass-jlink-plugin and
https://github.com/beryx/badass-runtime-plugin). The request for supporting
environment variables came from my users. They have actually other use
cases than the one involving $HOME, which I used in my example.
For some of these use cases, it's more difficult to find a solution that
doesn't require environment variables. That's why I'm asking for a generic
way of dealing with this issue.

Supporting environment variables in --java-options may also be a solution
for https://bugs.openjdk.java.net/browse/JDK-8250950 (allowing users to
specify their own memory requirements), for example using: --java-options
"-Xmx$MY_MAX_JAVA_HEAP".

Am Mo., 31. Aug. 2020 um 22:14 Uhr schrieb Michael Hall <mik3hall at gmail.com
>:

>
>
> > On Aug 31, 2020, at 3:07 PM, Michael Hall <mik3hall at gmail.com> wrote:
> >
> >
> >
> >> On Aug 29, 2020, at 3:37 AM, Serban Iordache <serban.iordache at gmail.com>
> wrote:
> >>
> >> Hi,
> >>
> >> Is there a way to pass values from environment variables when using
> >> --java-options?
> >>
> >> It would be nice to be able to write something like this:
> >> --java-options "-DmyAppData=$HOME/.myData”
> >
> > For this couldn’t you just pass the parameter without the path and then
> add it later?
> >
> > -DmyAppData=/.myData
> >
> > final String HOME = System.getProperty(“user.home”);
> >
> System.setProperty(“myAppData”,HOME+System.getProperty(myAppData),”.myData”);
>
> For user data these days don’t many platforms have preferred places for
> user data other than user home?
> It has occurred to me it might be nice of java had an API that actually
> automatically gave you the correct directory for a given platform to put
> your data. Maybe different locations for different types of user data.
>
>


More information about the core-libs-dev mailing list