Results 1 to 3 of 3
  1. #1
    ki_ha1984 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    118
    Rep Power
    0

    Default Execute a jar file with arguments from java code in MACOS

    Hi,

    I would like to ask you how i can execute a jar file from other jar file with arguments and redirect the output in file in MacOS.

    In windows i use this:
    Java Code:
    Runtime.getRuntime().exec("cmd /c java -jar "+folder+"/file.jar "+arg1+" "+arg2+" "+arg3+" "+arg2+" >> "+folder+"/"+logFileName+" 2>&1");
    Thank you in advace.

  2. #2
    ki_ha1984 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    118
    Rep Power
    0

    Default Re: Execute a jar file with arguments from java code in MACOS

    Any Idea please

    Thank you

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Execute a jar file with arguments from java code in MACOS

    Well there is no "cmd" on MacOS, so that is already not going to work.

    A Google for "java macos runtime.exec shell command" gives plenty of examples, like this one:

    osx - Execute external program from Java - Stack Overflow
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 2
    Last Post: 01-02-2015, 01:41 PM
  2. Execute Processing file from within Java
    By Smila in forum Advanced Java
    Replies: 4
    Last Post: 10-04-2012, 03:51 PM
  3. Execute .jar file within java program?
    By JHumphr in forum Advanced Java
    Replies: 2
    Last Post: 06-07-2011, 06:19 PM
  4. Replies: 1
    Last Post: 11-03-2009, 07:07 AM
  5. Compile/Execute code in Java app
    By Doctor Cactus in forum New To Java
    Replies: 5
    Last Post: 12-16-2008, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •