|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Mike,I wasn't planning on running it when a user is logged out, though actually I hadn't thought about that. Mostly I just don't have a need for a UI at the moment, so I just open it from a Terminal window and leave it running, and wanted to use the headless option to get the icon out of the Dock.If I ever package this up to share with others I'm sure it would have a UI to let users manage their own commands, so this isn't a huge deal. As I was just thinking about writing a UI to get around the problem, I thought I might write a Java version of 'xeyes', so maybe some good will come of it. :)(As you can tell, I've probably lived up here in Wasilla, Alaska for too long, and need to move back to the Lower-48, lol.)Thanks for your help,Al
From: Mike Swingler <email@hidden>
To: Alvin Alexander <email@hidden>
Cc: email@hidden
Sent: Tue, November 2, 2010 4:23:09 PM
Subject: Re: Problems running AppleScript with Java headless argumentOn Nov 2, 2010, at 12:23 PM, Alvin Alexander wrote: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).This is expected behavior. The core issue is not so much that the Java app is "headless" or "non-graphical", but rather that it has no main CFRunLoop running to dispatch the AppleScript commands on. By suppressing the startup of the AWT, the main event loop thread remains parked waiting in a lock. The Java process (which is the process actually running the script when you use the AppleScriptEngine) will not be able to dispatch any AppleScript, and will have to kick off sub-processes instead.Are you intending to run your server with the console user logged out?Curious,Mike SwinglerJava EngineeringApple Inc.
_______________________________________________ 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
| References: | |
| >Problems running AppleScript with Java headless argument (From: Alvin Alexander <email@hidden>) | |
| >Re: Problems running AppleScript with Java headless argument (From: Mike Swingler <email@hidden>) | |
| >Re: Problems running AppleScript with Java headless argument (From: Alvin Alexander <email@hidden>) | |
| >Re: Problems running AppleScript with Java headless argument (From: Mike Swingler <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
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.