Inputting data into an external app from Java

edited October 2016 in Java Beginners

I use this standard code to capture and display the output from an application in a JTextArea called outputTextServer1. The error checking has been removed. Works fine.

Process proc = null;
ProcessBuilder builder=null;
builder = new ProcessBuilder("java","-jar", "test.jar");                        
proc = builder.start();
Thread outputGobbler = new Thread(new StreamGobbler(proc.getInputStream(),  outputTextServer1));

I now want the user to be able to enter a command into a JTextField and for this to be sent back to the app. It is a complied app which can't be changed. I have read many variants using pipes, System.out and redirect but as far as I understand, none of these methods do this.The contents of the app can't be changed. How can this be done? (Can this be done?)

Thanks in advance.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!