jpackage OS X $APP_ROOT vs. $APPDIR also LSEnvironment in the plist

Michael Hall mik3hall at gmail.com
Sat Jan 26 02:18:52 UTC 2019


Just to note a few last other differences between legacy/manually built applications and jpackage ones.

I notice in the .cfg file that jpackage supports the $APPDIR variable for…

app.runtime=$APPDIR/PlugIns/Java.runtime

With AppBundler this used to be $APP_ROOT.  So I could do something like this in the JVMOptions of the plist…

-Djava.security.manager
-Djava.security.policy=$APP_ROOT/Contents/JavaApp/all.policy
-Dlog4j.configuration=file:$APP_ROOT/Contents/JavaApp/log4j.xml
-Dapp.lib=$APP_ROOT/Contents/JavaApp

This does not work with jpackage because it doesn’t seem to resolve $APPDIR for the jvm args
Whether it was a good idea to allow the application to give itself all.permissions I don’t know.
But, I set it up this way many years ago and haven’t had to worry about security issues since. 
I seem to remember that when I brought this up on OS X port they didn’t quite seem to understand the point of having the non-classpath JavaApp directory then either.
This won’t be cross-platform anyhow, so I am now considering some other all programmatic and not parm'ed solution to accomplish this.
However, you may at some time hear from someone else who used $APP_ROOT in their JVMOptions.

I think this was never tool supported either but the applications can sometimes need to set environment variables with the LSEnvironment plist key.
Currently I use it to set R_HOME for interfacing java and R. I have no serious use for this currently but have had limited success doing R commands and scripting from Java.
I remember using it in the past to set some AppleEvent debug flags as well. 
It can be set manually but an option of some sort for it could be nice.

Thanks,

Mike Hall





More information about the core-libs-dev mailing list