I have this code. The idea is that i send a command and i want to get the output in a stringbuffer that i then return.
The problem is that it works untill "line = in.readline()"
When i debug i receive that the application is running, but nothing happens.
Does anybody know what can be wrong?
Thank you
public StringBuffer executeSystemProcess(String process) {
String line = null;
StringBuffer param = new StringBuffer();
BufferedReader in = null;
try {
Process proc = Runtime.getRuntime().exec(process);
InputStreamReader inputStreamReader = new InputStreamReader(proc.getInputStream());
in = new BufferedReader(inputStreamReader);
line = in.readLine();
while (line != null) {
param.append(line);
param.append('\n');
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (in != null)
in.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
return param;
}
This post has been edited by B13ZT: 16 August 2011 - 04:36 AM

New Topic/Question
Reply




MultiQuote






|