Java Process without console or terminal

Discussion in 'Java' started by nico_zin@yahoo.com, Sep 22, 2006.

  1. Guest

    I have written a Java class that performs a
    Runtime.getRuntime().exec(cmd). The contents of 'cmd' in this case is
    the 'gpg' utility that depends quite a bit on stdin/stdout. I have
    built a simple command-line interface to this class for testing
    purposes. When testing, the utility works perfectly. However, when
    the class is packaged up and attempted to be used from a Windows
    Service for example, it fails.

    Initially, my 'cmd' contained "gpg --passphrase-fd 0 ..." and failed
    (error=2) with regards to the --passphrase-fd 0 reference. I then
    updated the 'cmd' reference to be "cmd /c gpg ..." and failed elsewhere
    throwing an IOException.

    Hunting around, the Java.io.Process class definition documents:

    "...The created subprocess does not have its own terminal or console.
    All its standard io (i.e. stdin, stdout, stderr) operations will be
    redirected to the parent process through three streams
    (Process.getOutputStream(), Process.getInputStream(),
    Process.getErrorStream()). The parent process uses these streams to
    feed input to and get output from the subprocess."

    I take it when running from a Windows service implies the parent
    process doesn't have standard I/O.

    I'm not sure if a simple solution is possible. Any help would be
    appreciated.

    thanks.
    , Sep 22, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gaurav kashyap
    Replies:
    3
    Views:
    6,639
    Paul Boddie
    Oct 31, 2008
  2. Chris Rebert

    Re: Password input in console/terminal

    Chris Rebert, Dec 9, 2008, in forum: Python
    Replies:
    1
    Views:
    320
    cadmuxe
    Dec 9, 2008
  3. rickman
    Replies:
    3
    Views:
    685
    HT-Lab
    Jan 7, 2009
  4. Jan Pech
    Replies:
    0
    Views:
    438
    Jan Pech
    Jan 6, 2009
  5. Steve
    Replies:
    2
    Views:
    931
    edicionsdigitals.com edicions digitals xarxa socia
    Dec 7, 2010
Loading...

Share This Page