Actually showing the command window after Runtime.exec in Java 1,4+

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Goldwater

    #1

    Actually showing the command window after Runtime.exec in Java 1,4+

    I have a situation where I actually _do_ want the command window to
    show after a runtime.exec() call. (Although we pipe stout/stdin to
    our own logging mech, the program needs to be able to trap Ctrl-C
    keystrokes). Our application is launched by javaw.

    In Java 1.3.1, this behaviour was present (and much resented it looks
    like) but in 1.4+ Sun have 'fixed' it, and the dos window no longer
    pops up on a Runtime.exec("o urbatchfilelaun cher.bat") I tried doing
    an exec("cmd launcher.bat") but no joy there either.

    Is there any way of turning this behaviour back on? Thanks in
    advance,

    James.
  • Raymond DeCampo

    #2
    Re: Actually showing the command window after Runtime.exec in Java1,4+

    James Goldwater wrote:[color=blue]
    > I have a situation where I actually _do_ want the command window to
    > show after a runtime.exec() call. (Although we pipe stout/stdin to
    > our own logging mech, the program needs to be able to trap Ctrl-C
    > keystrokes). Our application is launched by javaw.
    >
    > In Java 1.3.1, this behaviour was present (and much resented it looks
    > like) but in 1.4+ Sun have 'fixed' it, and the dos window no longer
    > pops up on a Runtime.exec("o urbatchfilelaun cher.bat") I tried doing
    > an exec("cmd launcher.bat") but no joy there either.
    >
    > Is there any way of turning this behaviour back on? Thanks in
    > advance,
    >[/color]
    James,

    I wouldn't look for a solution to turn the behavior back on in Java.
    That will likely be fruitless.

    I would explore using different options to cmd (like /c) and also
    explore using the start command (go to Windows help for details). You
    might need to have multiple BAT files calling each with the start
    command, etc.

    Let me know how it works out.

    HTH,
    Ray

    --
    XML is the programmer's duct tape.

    Comment

    • Quiks

      #3
      Re: Actually showing the command window after Runtime.exec in Java 1,4+

      You could try with the '/c' option, this has worked very well for
      me....
      You could also read this
      (http://www.javaworld.com/javaworld/j...29-traps.html). It
      will give you some details about Runtime Execution in Java.....

      Quiks.
      --------------
      BTW: For those who have to do with monitoring, check the site:
      http://www.metamindsolutions.com. It's a great multiplatform
      monitoring solution and seems to have been adopted by large accounts


      james@eccehomo. co.uk (James Goldwater) wrote in message news:<3e89860f. 0408270244.5cc1 dbd1@posting.go ogle.com>...[color=blue]
      > I have a situation where I actually _do_ want the command window to
      > show after a runtime.exec() call. (Although we pipe stout/stdin to
      > our own logging mech, the program needs to be able to trap Ctrl-C
      > keystrokes). Our application is launched by javaw.
      >
      > In Java 1.3.1, this behaviour was present (and much resented it looks
      > like) but in 1.4+ Sun have 'fixed' it, and the dos window no longer
      > pops up on a Runtime.exec("o urbatchfilelaun cher.bat") I tried doing
      > an exec("cmd launcher.bat") but no joy there either.
      >
      > Is there any way of turning this behaviour back on? Thanks in
      > advance,
      >
      > James.[/color]

      Comment

      Working...