I've used a java program to create a batch file, now I want to execute the .bat from within the source code. I've got the following code but it doesn't seem to do anything:
The function doesn't chuck up any errors, it looks as though it works but the .bat file doesn't run. Double clicking the .bat file whilst in windows works fine so there's nothing wrong with the .bat file.
What do I need to add/change to the code to get it running?
Thanks.
Code:
public void runBatch() throws IOException{
System.out.println("Running the batch script");
Runtime.getRuntime().exec("G:/Java/Batch.bat");
System.out.println("Finished running the batch script");
}
The function doesn't chuck up any errors, it looks as though it works but the .bat file doesn't run. Double clicking the .bat file whilst in windows works fine so there's nothing wrong with the .bat file.
What do I need to add/change to the code to get it running?
Thanks.