Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Starting an mac application

Reply
Thread Tools

Starting an mac application

 
 
Christian
Guest
Posts: n/a
 
      03-14-2007
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
 
Reply With Quote
 
 
 
 
vladimir.olexa@gmail.com
Guest
Posts: n/a
 
      03-14-2007
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.

On Mar 14, 12:49 pm, Christian <(E-Mail Removed)> wrote:
> Hello
>
> I have got some Mac Application that I want to start with some parameters
>
> ...
> ProcessBuilder pb = new
> ProcessBuilder(tooFreeApp.getPath(),"-data",myRootPath.getPath(),appargumen ts);
> 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



 
Reply With Quote
 
 
 
 
Christian
Guest
Posts: n/a
 
      03-15-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) schrieb:
> 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 ?



>
> Hope this helps.
>
> On Mar 14, 12:49 pm, Christian <(E-Mail Removed)> wrote:
>> Hello
>>
>> I have got some Mac Application that I want to start with some parameters
>>
>> ...
>> ProcessBuilder pb = new
>> ProcessBuilder(tooFreeApp.getPath(),"-data",myRootPath.getPath(),appargumen ts);
>> 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

>
>

 
Reply With Quote
 
Christian
Guest
Posts: n/a
 
      03-15-2007
Christian schrieb:
> (E-Mail Removed) schrieb:
>> 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 ?
>

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.


>
>
>> Hope this helps.
>>
>> On Mar 14, 12:49 pm, Christian <(E-Mail Removed)> wrote:
>>> Hello
>>>
>>> I have got some Mac Application that I want to start with some parameters
>>>
>>> ...
>>> ProcessBuilder pb = new
>>> ProcessBuilder(tooFreeApp.getPath(),"-data",myRootPath.getPath(),appargumen ts);
>>> 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

>>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui C++ 0 04-27-2009 12:51 PM
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui C Programming 0 04-27-2009 12:51 PM
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui Python 0 04-27-2009 12:46 PM
Starting a GUI application out of an console application Fabian Steiner Python 1 07-17-2006 05:01 PM
Starting python within Java - Mac OS X Jimmy Java 0 11-15-2005 03:51 PM



Advertisments