|Re: RCP, Environment Variables, OS X, Info.plist and LSEnvironment [message #1705197 is a reply to message #1703938]
||Wed, 12 August 2015 17:36
| Jim Klo
Registered: September 2012
Brian de Alwis wrote on Wed, 05 August 2015 19:54|
Sounds like you want to use System.loadLibrary() with absolute paths?
That doesn't quite work, as we aren't using JNI. Unfortunately the use-case details get pretty complicated - so I omitted in an effort to make it simpler to understand the problem.
Basically we have built an IDE that uses the Prolog interpreter, XSB. XSB natively connects to MySQL using the shared MySQL libs. Unfortunately on OS X, MySQL can get installed into possibly one of many locations, and it certainly doesn't install it's libs in /usr/local/lib or /usr/lib. We access XSB via a Java library called Interprolog, which I believe, is just a pipe interface to the command line shell - hence when the Interprolog engine object is instantiated, it fires up a shell process for XSB - which needs to locate those MySQL libraries. Hence, DYLD_LIBRARY_PATH needs to be set to have the path for /usr/local/mysql/lib (or wherever the user installed it) defined in the parent process in order for Interprolog's sub-process to pick up the environment variable.
Right now there are only 2 reliables ways I have found to get this to work.
1. Launch Terminal, export the environment variable. Then launch our RCP app from the Terminal. - cumbersome and unintuitive; bad user experience.
2. Launch Terminal, use `launchctl setenv DYLD_LIBRARY_PATH /usr/local/mysql/lib`. And then one can lacuna our RCP app using Finder. - problem is that DYLD_LIBRARY_PATH is now global to the environment and will not persist between reboots.
I've tried added the LSEnvironment dictionary to the Info.plist within the RCP application, but that just doesn't seem to work - and I'm not sure if that is because the OS X eclipse launcher doesn't propagate the environment forward or what. For the time being I have a way for the user to click a button which runs launchctl setenv and then prompts the user to exit the app, and then launch again from finder [IWorkbench.restart() doesn't work because new process is a child of the current] - which works but is undesirable workflow as it doesn't persist across a login/reboot.
My next step is to try what is outlined here: http://stackoverflow.com/questions/829749/launch-mac-eclipse-with-environment-variables-set
However it feels even more sketchy than just modifying the Info.plist to contain the right environment variables.
Powered by FUDForum
. Page generated in 0.01955 seconds