Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: runtime.exec




On 6 Oct 2004, at 12:05 AM, David Rocks wrote:

I have run into more problems. When I try to run osascript through runtime.exec in a java program it appears to go into la-la land. I see no activity, and it also appears that the interface is hung. I am able to trace the plugins call to the browser, but when I use osascript it appears to hang on the 1st call and all subsequent calls don't appear in the trace, as if the plugin is hung and not processing any more requests. Not the behavior using the open command or calling the browser directly. There I can see trace records everytime I call the plugin. The call statement looks OK in the trace. And I have no problem with identical calls in the apple script editor or issuing the commands in the terminal shell. Is there something different about the way osascript is executed when called from within a program?

This sounds similar to a problem I just had. I had an About Dialog with a clickable URL in it and was using Runtime.exec() to run "/usr/bin/open" and open the URL in Safari.


That all worked, but then the java application hung when you switched back to it.

Doing "kill -QUIT <pid>" on the java proc, I found the problem was in the Application event queue. The AboutDialog had been triggered by by an ApplicationEvent. As long as the modal About Dialog was being displayed, the Application event queue was still locked.

When I switched back to the java App, i got a ReOpenApplication event, which couldn't be processed until my About Dialog closed, but i couldn't get back to that because the Application couldn't regain focus until the ReOpenApplication event was processed. Deadlock!

The fix was simply to display the dialog from a call to SwingUtilities.invokeLater() which returns immediately freeing up the Application queue

I don't know anything about plugins, but you could have a similar problem where the plugin is hanging when trying to regain focus after switching back from the launched osascript.

This would explain why the first call works, but further ones don't.

--
Rohan Lloyd

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

This email sent to email@hidden
References: 
 >Re: runtime.exec (From: Greg Guerin <email@hidden>)
 >Re: runtime.exec (From: David Rocks <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.