Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Problems running AppleScript with Java headless argument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems running AppleScript with Java headless argument



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)
at apple.applescript.AppleScriptEngine.eval(AppleScriptEngine.java:342)
at apple.applescript.AppleScriptEngine.eval(AppleScriptEngine.java:313)

I'm running the AppleScript commands like this:

ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("AppleScript");
engine.eval(myAppleScriptCommand);

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).

Thanks,
Al

Alvin Alexander
http://devdaily.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.