My code:
String correr = "msg /SERVER:" + NomePC.replace(" ", "") + " * /TIME:300 \"" + Mensagem + "\"";
Process textoo = null;
try {
textoo = Runtime.getRuntime().exec(correr);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
BufferedReader innTexto = new BufferedReader(new InputStreamReader(textoo.getInputStream()));
String lineTexto=null;
try {
lineTexto = innTexto.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (lineTexto != null) {
System.out.println("Não passou");
}
else if (lineTexto == null) {
System.out.println("A sua mensagem foi enviada com sucesso para " + NomePC + " ás: " + dataFormatada);
}
So my readLine is always null and I don't know why. I've printed it out to confirm. When I execute my command in cmd directly I had an answer. So why isn't it reading the line?