PaulS:
And this is somehow Eclipse or avrdude's fault?
kinda mine but look;
i copy this command into command line it works:
C:\Users\Amatalamessinaj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\Amatalamessinaj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM12 -b115200 -D -Uflash:w:C:\Users\AMATAL~1\AppData\Local\Temp\arduino_build_698060/Final_servos.ino.hex:i
this is the error i get:
Cannot run program: CreateProcess error=2, The system cannot find the file specified
but when i do the same in java it doesn't:
runCommand(new String[]{"C:\Users\Amatalamessinaj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\Amatalamessinaj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM12 -b115200 -D -Uflash:w:C:\Users\AMATAL~1\AppData\Local\Temp\arduino_build_698060/Final_servos.ino.hex:i"});
ho really sorry this is the error of java no command line
i also test this in command line after moving avr files into java root project it works fine:
C:\Users\Amatalamessinaj\workspace\test>avrdude -Cavrdude.conf -v -patmega2560 -
cwiring -PCOM6 -b115200 -D -Uflash:w:test.ino.hex:i
but in java it give me the same error:
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
it was not a problem of file but i think it is somewhere between these 2 way of running command:
i'm trying to figure whats wrong but if u found before me i'll be honor to hear from my "stupid" error
new Thread(new Runnable() {
public void run() {
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String line = null;
this way it doesn't work:
runCommand(new String[]{"avrdude -Cavrdude.conf -v -patmega2560 -cwiring -PCOM6 -b115200 -D -Uflash:w:Final_servos.ino.hex"});
static void runCommand(String[] cmd){
String s = null;
try {
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// read the output from the command
System.out.println("command out:\n");
while ( (s = stdInput.readLine ()) != null) System.out.println(s);
System.out.println("errors (if any):\n");
while ( (s = stdError.readLine ()) != null) System.out.println(s);
}catch (IOException e) {
System.out.println("something went wrong: \n");
e.printStackTrace();
}
That Java code is flawed. It may work most of the time but at some point it will jump up and bite you. If contains 3 of the traps described in the "When Runtime.exec() won't" article I gave you the reference to. One of the traps can cause a deadlock. You really need to read that article and implement the recommendations.