Starting an mac application

C

Christian

Hello


I have got some Mac Application that I want to start with some parameters

....
ProcessBuilder pb = new
ProcessBuilder(tooFreeApp.getPath(),"-data",myRootPath.getPath(),apparguments);
pb.redirectErrorStream(true);
process = pb.start();
BufferedReader i = new BufferedReader(new InputStreamReader(
process.getInputStream() ) );
String read;
while (null != (read =i.readLine())) {System.out.println(read);}

....


the code above seems to work on windows with some .exe file but not on
mac with the corresponding .app file.

Someone got an idea what I could do?


Christian
 
V

vladimir.olexa

Well, .exe is an entirely different concept than .app. .app is nothing
but a package, a directory if you will, so passing parameters to it
isn't actually passing it to the executable but to the whole package.
So the actual UNIX executable is really located inside that package.
Let's say you have an app called Foo.app, then your executable would
be in Foo.app/Contents/MacOS/Foo. So you may wanna try to pass your
parameters directly to that and see if that works.

Hope this helps.
 
C

Christian

Well, .exe is an entirely different concept than .app. .app is nothing
but a package, a directory if you will, so passing parameters to it
isn't actually passing it to the executable but to the whole package.
So the actual UNIX executable is really located inside that package.
Let's say you have an app called Foo.app, then your executable would
be in Foo.app/Contents/MacOS/Foo. So you may wanna try to pass your
parameters directly to that and see if that works.

this doesn't work ...
if I start Foo.app/Contents/MacOS/Foo directly the program will just crash.

may be I can use
open -a Foo.app parms somehow ?
 
C

Christian

Christian said:
this doesn't work ...
if I start Foo.app/Contents/MacOS/Foo directly the program will just crash.

may be I can use
open -a Foo.app parms somehow ?
open Foo.app

does not work with process builder, but with Runtime.getRuntime().exec()

though I seem to be unable to pass arguments to the program that way
which is crucial.

someone a hint?

I just need to start that application with some arguments in a
subprocess... so I know when the app terminates.

thats something that simply must be easy ... shame on me I havend
figured it out by now ...
but I am simply clueless..

please help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top