runtime.exec - how to invoke sh file in linux terminal using Runtime.getRuntime().exec in java -
how invoke sh file in linux terminal using runtime.getruntime().exec
in java ?
i want invoke sh file in new terminal java code. if run in terminal runs separate process, not closed if programs exits. , thats why i'm not using processbuilder
, stops process invoked if program using exits.
if script marked executable (chmod +x script.sh
), can invoke exec("./script.sh")
. otherwise can directly call using exec("sh script.sh")
.
Comments
Post a Comment