I am trying to create a java swing app in which I want to use two text boxes one for input and other for output procedure. When i click the button I want to run the code in input text box and the output should be in output text box.
I try with the process builder. I open cmd using process builder and run program in it.it works fine if the program has only printing lines.But if the program ask for input it is not working.
Which we can do in eclipse IDE in which the program is running in console window and we can give input at that time.
Then I convert the input program to jar file and try to run it code:
String demo = "javaw -jar D:\\x.jar";
Process proc = Runtime.getRuntime().exec(demo);
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String f;
while((f=br.readLine()) != null)
{
System.out.println(f);
}
proc.waitFor();
br.close();
Or there is another way without using cmd plz tell me. How can I write appropriate code for it ?