Results 1 to 4 of 4
  1. #1
    apremanandh is offline Member
    Join Date
    May 2008
    Posts
    1
    Rep Power
    0

    Default Execute a jar command from a java program

    Hi,

    I need to execute a jar command from the java program. And also need, that jar command must execute in the place (path like "C:/Sample/ jar..") where specified. current i am using

    In Windows,
    String cmd = "cmd /c jar uf " + instalationPath + jarName + " " + param ;
    Runtime.getRuntime().exec(cmd);

    But, i am not able to use the same command for Linux, Solaris and Macintosh, please help to resolve this issue.

    Any equivalent command are available?.Kindly Help Me.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes you can't.

    Try something like,

    Java Code:
    Runtime.getRuntime().exec()

  3. #3
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    You're using a prefix string "\\" in windows, which is i think is different from Linux, Mac and Solaris, try to search for it...
    Last edited by sukatoa; 05-21-2008 at 01:35 PM.
    freedom exists in the world of ideas

  4. #4
    Join Date
    May 2008
    Posts
    5
    Rep Power
    0

    Default

    You're using a prefix string "\\" in windows, which is i think is different from Linux, Mac and Solaris, try to search for it...
    With regards sukatoa for cross platform isnt there the seperator keyword for this?

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  2. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  3. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 AM
  4. Execute a new program in java
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 05:42 AM
  5. Replies: 1
    Last Post: 07-27-2007, 05:46 PM

Posting Permissions

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