Login

Java code to Execute Shell script

Program to Execute Shell script / batch file using Java

In normal we Execute Java program using shell script . But here we are creating java program to execute shell script / batch file.
This can be done by using executing the system process using "Process proc = Runtime.getRuntime().exec("./execute_shell_using_java.sh");". This is a simple program that will just execute the sh/ shell script file execute_shell_using_java.sh.
Note: sh file will not run in windows and bat file will not run in linux