Results 1 to 4 of 4
  1. #1
    2bGeek is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default How to execute external EXE?

    Hi,

    I'm trying to make a GUI so that it can run a third-party command-line exe.
    the command that I'm trying to work on is as follows on netbeans:

    clic mp3play.gd -i c:\test.mp3

    where:
    clic is the main exe.
    mp3play.gd -i is the parameter
    test.mp3 is the actual file, which is the user input.

    I have tried using runtime class. but it doesn't seem to work..
    Thanks in advance
    Pls do help me out.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    Maybe this will help:
    When Runtime.exec() won't - JavaWorld

    db

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Runtime.exec returns a process. Do a 'process.join' on that to ensure the process has finished. Then you can get the InputStream and error streams for the process to see what happened. But looking at what you have, my guess is you are trying to do something like

    Java Code:
    Runtime.getRuntime.exec("clic mp3play.gd -i c:\test.mp3");
    Which isn't going to work, because '\' is the escape character in java, so it's going to convert the '\t' in 'c:\test.mps' into a tab character. The OS will not find a file called c:{tab}est.mp3 and the clic command will fail.

  4. #4
    2bGeek is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 03:40 PM
  2. Using Runtime to execute external commands
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 10:14 AM
  3. Replies: 0
    Last Post: 10-04-2007, 10:33 PM
  4. Execute Jar file
    By barney in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 08:13 AM
  5. why does not execute this?
    By aleplgr in forum New To Java
    Replies: 6
    Last Post: 08-01-2007, 12:37 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
  •