ok. non è che conosci anche il modo di catturare, oltre agli output sul terminale, anche gli output prodotti da un eventuale programma su una finestra grafica?Originariamente inviato da morphy79
si appunto...
se vuoi leggere lo stream devi usare input, non output !!
codice:// FUNZIONE PER ESEGUIRE UN FILE .EXE O .BAT public int runFile(String pathfile){ int exitVal = 0; String errors = ""; try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + pathfile); InputStream stderr = proc.getErrorStream(); InputStreamReader isr = new InputStreamReader(stderr); BufferedReader br = new BufferedReader(isr); String line = null; errors = errors + "Process exeFileName: " + pathfile + "\r\n"; while ( (line = br.readLine()) != null){ errors = errors + line + "\r\n"; } exitVal = proc.waitFor(); errors = errors + "Process exitValue: " + exitVal; } catch (Throwable t){ // SCRITTURA LOG System.out.println("JAVA ERROR " + t.getMessage()); exitVal = -1; } return exitVal; }