> On Sep 1, 2020, at 5:22 PM, Michael Hall <mik3h...@gmail.com> wrote:
> 
> 
>> 
>> 
>>> 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"
>>> 
>>> (Instead of using the $ sign, another notation may be more appropriate, in
>>> order to not conflict with macros such as $APPDIR or $ROOTDIR.)
>> Although I don't think there is a problem conflicting with the existing 
>> macros for $ROOTDIR, $APPDIR, or $BINDIR, we may need something more 
>> exclusive that "$XXXX" since dollar sign may be a legitimate character in an 
>> existing argument or vm option ("-DPRICE=$10.50") or ("-DCURRENCY_TAG=$")
>> 
>> anyway, wouldn't this go a long way to alleviating the concerns of 
>> JDK-8250950 <https://bugs.openjdk.java.net/browse/JDK-8250950> ?
>> 
>> 
> If I follow the referenced issue, after a quick browse, it wants to satisfy 
> the need for different user memory specifications. It proposes doing this 
> with a standalone configuration file that could override the one jpackage 
> uses. So could be used for more general overrides.
> You are now thinking environment variables could provide the override without 
> the need for a second user/developer configuration file? 
> I am not sure that works. Actually, I don’t think the environment variable 
> settings would be very useful on OS X at all after considering this issue. 
> On OS X applications get a default set of environment variables not dependent 
> on user ones. 
> Looking like this from an application of mine…
> 
> exec env
> TMPDIR=/var/folders/dh/91wmrk0n6lzfmr4tjhjmcfp40000gn/T/
> __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0y for 
> HOME=/Users/mjh
> SHELL=/bin/bash
> Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.sZlyFCZcWZ/Render
> SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.f11OdXASJN/Listeners
> PATH=/usr/bin:/bin:/usr/sbin:/sbin
> LOGNAME=mjh
> DISPLAY=/private/tmp/com.apple.launchd.rN2uW3mk7s/org.macosforge.xquartz:0
> XPC_SERVICE_NAME=us.hall.FastRGraalHP.35068
> USER=mjh
> XPC_FLAGS=0x0
> 
> My own settings from Terminal (.bash_profile) are more involved say for the 
> PATH variable…
> 
> env | grep PATH
> PATH=/Users/mjh/anaconda3/bin:/Users/mjh/anaconda3/condabin:/opt/ooRexx/bin:/usr/local/Cellar/watchman/4.9.0_3/bin:/Users/mjh/management/spark-2.4.3-bin-hadoop2.7/bin:/Users/mjh/management/apache-maven-3.6.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
> ...
> 
> So I’m not sure passing things to the application at launch time by 
> environment variable would work? At least OS X. If as I think the issue 
> indicated you wanted a cross-platform solution.

On macOS you need to set the variables differently, but I think it can still 
work. The variables known to your shell are not the same as those known to 
LaunchServices. For those use the launchctl command to set them. 


Scott

Reply via email to