java - redirecting console output of a compiled file to GUI -


i making application take input java program, compile , show output after running on screen in text box. not able figure out way redirect output of program onto screen. please me out.

try this:

process proc = processbuilder.start(); ctrl.clear(); reader = new bufferedreader(new inputstreamreader(proc.getinputstream())); while(true) {     int exitvalue;     try     {         proc.exitvalue();         system.out.println("process ended exit value "+ exitvalue);     }     catch(illegalthreadstateexception e)     {// process alive         try         {             final string str = reader.readline();             if (str!=null)             {                 //print string somewhere             }         }         catch(ioexception ignored)         {         }     } } 

edit: note have processes instance. how doesn't matter.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -