Subscribe:

Main Menu

Selasa, Mei 20, 2008

Jalankan File Executable di java

private String Jalankan(String perintah) throws IOException {
Process p = Runtime.getRuntime().exec(perintah);
InputStream stdoutStream = new BufferedInputStream(p.getInputStream());

StringBuffer buffer= new StringBuffer();
for (;;) {
int c = stdoutStream.read();
if (c == -1) break;
buffer.append((char)c);
}
String outputText = buffer.toString();

stdoutStream.close();

return outputText;
}

0 komentar: