0

Am running .exe file from java code using ProcessBulider, the code I have written is given below. The .exe file takes Input.txt(placed in same directory) as input and provide 3 output file in same directory.

public void ExeternalFileProcessing() throws IOException, InterruptedException {

    String executableFileName = "I:/Rod/test.exe;

    ProcessBuilder processBuilderObject=new ProcessBuilder(executableFileName,"Input.txt");

    File absoluteDirectory = new File("I:/Rod");

    processBuilderObject.directory(absoluteDirectory);

    Process process = processBuilderObject.start();

    process.waitFor();
}

this process is working fine by call ExeternalFileProcessing(). Now am doing validation process, If there is any crash/.exe file doesn't run, I should get the error message how can I get error message?

Note: It would be better that error message be simple like run successful/doesn't run successful or simply true/false, so that I can put this in If condition to continue the remaining process.

4

2 に答える 2