Results 1 to 3 of 3
  1. #1
    msanders is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default Launch External Console app

    Hello, i have a few C programs that i would like to be able to launch from java, i have tried using a ProcessBuilder and runtime.exec to launch it but it doesn't seem to display the Command prompt with the output. But it does start the process as its in the task manager.

    so i am using:

    Java Code:
      Process process = new ProcessBuilder(runPath).start();
    Just wondering if i need an extra parameter or something, i have spent too long trying everything and google seems to be hiding the answer :(

    It has to be done like this are the C apps would take some weeks porting to Java.

    Any Help please :)

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    As you have noticed, starting an executable file doesn't start another console for you; you have to do that yourself: your Java program starts another shell/console that starts your executable file.

    kind regards,

    Jos

  3. #3
    msanders is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default

    ooh yeah, silly me!

    i am now using:

    Java Code:
    Runtime.getRuntime().exec("cmd.exe /c start")
    i have spent the last few months coding in ANSI C and C# 2008 and i just don't get along too well in Java now.

    Thanks

Similar Threads

  1. Launch Error
    By roughjj in forum Eclipse
    Replies: 1
    Last Post: 10-30-2009, 08:59 PM
  2. Replies: 2
    Last Post: 09-25-2009, 07:13 PM
  3. How I launch an external program and kill the father?
    By Dr_Misterio in forum New To Java
    Replies: 2
    Last Post: 08-05-2009, 04:31 PM
  4. Replies: 1
    Last Post: 12-13-2008, 02:24 AM
  5. launch a browser with a button
    By lemon3 in forum NetBeans
    Replies: 1
    Last Post: 07-07-2008, 06:49 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
  •