Results 1 to 4 of 4
  1. #1
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    5

    Default help with data output, input

    Hi, not sure if this is considered a "New to Java" question but i have a program, "java1" that uses Process to call "java2", Process "p".
    Then I run this code:
    Java Code:
    stdOutput = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
    String input = textIn.getText();
    stdOutput.write(input + "\n", 0, input.length() + 1);
    My java2 program is running:
    Java Code:
    InputStreamReader istream = new InputStreamReader(System.in) ;
    BufferedReader bufRead = new BufferedReader(istream) ;
    String firstName = bufRead.readLine();
    The problem is that java2 doesn't receive the data that I send it. Any ideas?
    Thanks

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  3. #3
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    5

    Default

    Java Code:
    stdOutput.write(input + "\n", 0, input.length() + 1);
    I thought that would do it...No?
    Also, my program is waiting for "stdInput" from the process via a Thread, AND waiting for "stdError" via the Main Thread. java1 has an event listener that will call the above code ^^. This event listener will interrupt waiting for input from stdError, right? Or should I make waiting for stdError a separate Thread too?

    Oh yeah, I read input from a JTextArea if that helps.
    Last edited by collin389; 11-11-2009 at 06:34 AM.

  4. #4
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    5

Similar Threads

  1. Replies: 3
    Last Post: 09-22-2009, 05:16 AM
  2. Replies: 1
    Last Post: 08-04-2009, 12:48 PM
  3. Single XSD Creation for input/output
    By lavanya82 in forum XML
    Replies: 0
    Last Post: 03-13-2009, 12:02 PM
  4. Replies: 4
    Last Post: 10-02-2008, 10:05 PM
  5. Runtime.exec(), handling input and output streams
    By crookshank in forum New To Java
    Replies: 0
    Last Post: 06-05-2008, 02:41 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
  •