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: why isnt my wait() and waitFor() working? please help



Greg Guerin  wrote:
If all you want to know is "Did the app exit?", then another way is to
launch QT Player yourself, exec()'ing it directly, so the Java Process
really does represent the app. (You actually have to exec() the executable
file inside the .app bundle, at Contents/Resources/MacOS/Quicktime Player.
Refer to Apple's docs on bundle internal anatomy for details.) Then you
can 'open' files for it, which 'open' will happily pass to QT Player for
playblack, but your Java app can still tell when QT Player exits.
What do you mean by "exec{}'ing it directly"? You mean double click on quicktime Player or you mean this:
process qt = Runtime.getRuntime.exec("/Applications/quicktime player/macos/contents/quicktime player");   ?
I tried doing that but the console complains at the spaces between quicktime and player. I tried "\*" fix from windows, "\\" for a :"spa! ce" character and other methods but couldnt get it working.. any fix for that?
 
Also, if it gets fixed and runs do I make another process - Process B= Runtime.getRuntime.exec("open " + file.getPath());? I dont see how opening quicktime first will affect the command "open"... if you can elaborate or provide example that would be greatly appreciated..
 
And by the way, i am trying to make a program where it receives incoming audio and plays it on quicktime then when that particular player closes it will send back to the other person another audio.
 
I also discovered a way to not use quicktime player but instead use movie and moviePlayer classes to display it inside a panel.. not sure if that will work with listeners or not....
 
thanks


Greg Guerin <email@hidden> wrote:
Shou ryuujo wrote:

>o man... didnt know it would be that complicated... so to find out if the
>application closes i have to use osascript?

Not necessarily. That's just one way, off the top of my head.

If all you want to know is "Did the app exit?", then another way is to
launch QT Player yourself, exec()'ing it directly, so the Java Process
really does represent the app. (You actually have to exec() the executable
file inside the .app bundle, at Contents/Resources/MacOS/Quicktime Player.
Refer to Apple's docs on bundle internal anatomy for details.) Then you
can 'open' files for it, which 'open' will happily pass to QT Player for
playblack, but your Java app can still tell when QT Player exits.

You could also write native code that waited for an arbitrary process to
terminate. You'd then figure out QT Player's process ID, pass that to the
native code, and voila.
You should also recognize that closing the last window in QT Player will
NOT cause it to exit. That's a Windows-ism, not a Mac-ism.


>Another question is is there a way that i can put the quicktime application
>inside a Jpanel? i mean if i did that then i can put a button in and close
>the application that way right? thanks

I know of no way to do that on Mac OS X. Embedding applications in one
another's windows is another Windows-ism. It'd be simpler to use QuickTime
for Java and create a playback component. Then you don't have to exec()
anything. As I recall, QTJ is also available on Windows.

It might help if you told us what you're trying to accomplish by waiting
for QT Player to exit.

-- GG


_______________________________________________
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


Yahoo! Mail
Use Photomail to share photos without annoying attachments.
 _______________________________________________
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: why isnt my wait() and waitFor() working? please help (From: Greg Guerin <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.