I have a script in amazon machine and i would run this script using ssh from netbeans. i use this code :
String myKey="/home/local/my_key.pem";
Runtime runtime = Runtime.getRuntime();
String commande = "ssh -i "+myKey+" [email protected] 'bash runFile.bash' -o StrictHostKeyChecking=no ";
Process p = runtime.exec(commande);
p.waitFor();
But it does not work. When i print p.getErrorStream() I obtain:
bash: writeFile.bash: command not found
When i run the commande from bash it works but in netbeans no !
Someone can explain me why ? other solution please ?
Thanks
p'sgetOutputStream()andgetErrorStream()to see if you can see what the problems may be~/local/my_key.pem?writeFile.bash? is it a file you are trying to execute? is it where it is supposed to be? is it executable? try executing./writeFile.bash