I'm trying to run some AppleScript commands from a Java application, and everything works fine until I tell the Java application to start up in headless mode with the "-Djava.awt.headless=true" JVM argument. When I do this I get an exception that looks like this:
javax.script.ScriptException: Application is background-only.
at apple.applescript.AppleScriptEngine.evalScript(Native Method)
I'm running the AppleScript commands like this:
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("AppleScript");
I'm using Java 1.6.0_20 on Mac OS X 10.6, and again, everything works just fine without
the "headless" argument, which I would really like to be able to use, since there is no UI with this app (a speech recognition server).