Possible Duplicate:
How to use javas Process.waitFor()?
I have a program to upload to Arduino in my pc. I created a makefile for compiling and uploading it to arduino fio.
It works fine. Now I am trying to create a java program for executing that makefile but I have problems with this order:
Runtime.getRuntime().exec("make");
When I execute it, program gets blocked.
Is there anything I should do to execute that order? With other orders, it works fine. make clean, make depend....
I am trying with this code I found on internet for that task:
public static void prueba() throws InterruptedException, IOException {
Process proc = Runtime.getRuntime().exec("make");
int size;
String s;
int exCode = proc.waitFor();
StringBuffer ret = new StringBuffer();
while((size = proc.getInputStream().available()) != 0) {
byte[] b = new byte[size];
proc.getInputStream().read(b);
s = new String(b);
ret.append(s);
}
System.out.println(ret.toString());
}