keyboard into into a process object from within a thread

Discussion in 'Java' started by Wizumwalt@gmail.com, Feb 7, 2006.

  1. Guest

    I have a JPanel where, when the user clicks a button, it starts a
    MyProcess which is a class that I extend from Thread. From within the
    run() of class MyProcess, I have code like the following ...

    // ---
    ProcessBuilder pb = new ProcessBuilder("aprogram.exe", myInputFile);

    pb.directory(new File("aDir"));
    pb.redirectErrorStream(true);

    process = pb.start();

    in = new BufferedReader(new
    InputStreamReader(process.getInputStream()));
    out = new BufferedWriter(new
    OutputStreamWriter(process.getOutputStream()));
    // ---

    My problem is that, I want to type keyboard input from within my JPanel
    and have it fed into the stream so that aProgram.exe receives it as
    input. In sum, I want to feed a Process object keyboard input from a
    program that drops the thread and get it into the other program
    (aprogram.exe).

    Can anyone help out on how that should/might work? Any help much
    appreciated.
    , Feb 7, 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. John A. Bailo

    Kill Thread Within Java.exe Process

    John A. Bailo, Aug 3, 2007, in forum: Java
    Replies:
    3
    Views:
    1,922
    Mike Schilling
    Aug 3, 2007
  2. giohappy
    Replies:
    5
    Views:
    1,817
    giohappy
    Apr 15, 2009
  3. Thread within a thread

    , May 15, 2009, in forum: C Programming
    Replies:
    3
    Views:
    365
    CBFalconer
    May 15, 2009
  4. Jason
    Replies:
    1
    Views:
    111
    Lasse Reichstein Nielsen
    Sep 9, 2003
  5. John Reye
    Replies:
    6
    Views:
    345
    Adam Wysocki
    Nov 7, 2012
Loading...

Share This Page