I'm running a windows program from within java:
String command = "cmd /C start "+fileName+".bat"; Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(command, null, new File(currWD)); int exitValue = pr.waitFor();
The program completes successfully (exitValue == 0) and creates a file "fileName" in the working directory. I am trying in the same routine to find the size of this file:
xmlFileSize = (new File(fileName)).length();
Java finds the file yet it appear to be empty (xmlFileSize == 0). Once Java finishes I can see, however, that the file is non-empty.
How can I resolve this? All I want is that Java can correctly assesses the size of the file created by the windows program that Java has executed.