I have this code below - where the batch file is executed but the program wont execute the rest of the code rather it stay in the batch file itself. What I want to achieve is to have this BATCH file running while the rest of the code executes.
public class CmdJava {
public static void main(String[] args) throws IOException {
Process p = Runtime.getRuntime().exec("cmd /c call README.bat");
String s;
System.out.println(p.getOutputStream());
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
//code reaches and stops at this line as the batch file need to be forcefully closed
}
System.out.print("Need to reach this code");
}
}
Any help is greatly appreciated