OutputStream out;
public void Inicia(){
out= new OutputStream(){
public void write(byte[] b){
for(int i=0; i<b.length; i++){
write(b[i]);
}
}
public void write(int i){
jTextArea1.append(Character.toString((char) i));
}
};
System.setOut(new PrintStream(out));
}
Runtime r = Runtime.getRuntime();
Process p;
try {
p = r.exec("ping 192.168.254.254");
p.waitFor();
} catch (IOException ex) {
System.out.println("Erro na execucao do comando:\n" + ex.getMessage());
} catch (InterruptedException ex) {
ex.printStackTrace();
}
Ele não imprime o que seria mostrado no terminal. Alguém pode me ajudar?