On the PC i have the following:
Process p = Runtime.getRuntime().exec("C:\\program Files\\QuickTime\\QuickTimePlayer.exe "
+file.getPath());
p.waitFor();
It basically creates a process of QuicktimePlayer and runs the file specified. I then have p.waitFor() used to wait for the user to close the application so i can do listener stuff for it- it worked for PC.
On Mac
String b= "open"+ tempFile.getPath();
Process p= Runtime.getRuntime().exec(b);
System.out.println("before wait");
p.waitFor(); .
System.out.println("app. terminated");
output:*
before wait
Program terminates before System.out.println("app. terminated"); but the application (quicktime) starts.
if I do this:
String b= "open"+ tempFile.getPath();
Process p= Runtime.getRuntime().exec(b);
System.out.println("before wait");
// p.waitFor(); .
System.out.println("app.
terminated");
output:*
before wait
app.terminated
program terminates "normally" and I see "app.terminated".
I used Eclipse so the "red square" turns red when running it and suddenly grays out when the player appears. So to me the program terminated before the p.waitFor(); If i commented out p.waitFor() then the program goes to the System.out statement and everything goes "fine". I tried using thread.wait(), this.wait() p.wait() etc. but i get errors saying they are not owner of the thread. I am not sure why the program terminates before waitFor() and goes through if waitFor() isnt there.. please help!
thanks