Unable to get Applescript Engine on some computers

Michael Hall mik3hall at gmail.com
Thu Feb 27 03:07:44 PST 2014

On Feb 27, 2014, at 4:52 AM, Paul Taylor <paul_t100 at fastmail.fm> wrote:

> In my code I have:
> ScriptEngineManager mgr = new ScriptEngineManager();
> ScriptEngine engine = mgr.getEngineByName("AppleScript");
> this works fine for me, but for some customers in returns null for engine.
> We are using Java 1.8.0 25.0-b69 64bit (build 129)
> Customer was on Mac OS X 10.9.2 x86_64, I've upgraded to same version still don't get the problem.
> Applescript does exist because earlier in my code I run some applescript using osascript and Runtime class and that works fine

l don't know that it was precisely determined what caused this. Possibly some change in an OS upgrade where Apple removed something from their java distribution?
Although we didn't know it, we were relying on the Apple code being in place.
Your three options would be…

Provide the code in the jar and dylib yourself. This is what I did and what I made available on github at…
All you really need are the jar and dylib.
Put the dylib in the application's MacOSX folder. appbundler adds that to LD_LIBRARY_PATH.
Put the jar in the application's Java folder, this should get it into class path.
Done and should work on any configuration.

Fix the openjdk configuration error yourself. This means adding the AppleScriptEngine entry to the config file in resources.jar. I believe the bug report I gave earlier details how to do that.

Wait for openjdk to correct the configuration file in resources.jar

My understanding on that one anyhow.

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter

More information about the macosx-port-dev mailing list