0
I am trying to run a file in java with the following command
System.out.println("Linux");
String[] env = {"PATH=/bin:/usr/bin/"};
String cmd = System.getProperty( "user.dir" ) + "/config/atualiza.sh";
try {
Process process = Runtime.getRuntime().exec(cmd, env);
} catch (IOException ex) {
Logger.getLogger(TestandoSO.class.getName()).log(Level.SEVERE, null, ex);
}
But nothing happens.
I have already tested running through the terminal sh and runs normally.
My goal is to call another file jar. As I could not by Java I am trying by sh
https://stackoverflow.com/a/15428431/4319922
– StatelessDev
I think you should use the class Processbuilder https://docs.oracle.com/javase/6/docs/api/java/lang/ProcessBuilder.html
– renanvm