Starting an mac application

Discussion in 'Java' started by Christian, Mar 14, 2007.

  1. Christian

    Christian Guest

    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
     
    Christian, Mar 14, 2007
    #1
    1. Advertising

  2. Christian

    Guest

    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 <> 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
     
    , Mar 14, 2007
    #2
    1. Advertising

  3. Christian

    Christian Guest

    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 <> 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

    >
    >
     
    Christian, Mar 15, 2007
    #3
  4. Christian

    Christian Guest

    Christian schrieb:
    > 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 <> 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

    >>
     
    Christian, Mar 15, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jimmy
    Replies:
    0
    Views:
    396
    Jimmy
    Nov 15, 2005
  2. Roman =?ISO-8859-15?Q?Bl=F6th?=

    Senseless rendering: Mac.Mozilla != Mac.Netscape6.01 ?!?!

    Roman =?ISO-8859-15?Q?Bl=F6th?=, Jul 2, 2003, in forum: HTML
    Replies:
    1
    Views:
    1,009
    Steve Pugh
    Jul 2, 2003
  3. (Pete Cresswell)

    Auto-starting a CD on Mac?

    (Pete Cresswell), Oct 22, 2004, in forum: HTML
    Replies:
    11
    Views:
    594
    brucie
    Oct 22, 2004
  4. mangm
    Replies:
    2
    Views:
    761
    mangm
    Dec 1, 2005
  5. Fabian Steiner
    Replies:
    1
    Views:
    622
    faulkner
    Jul 17, 2006
Loading...

Share This Page