The tester program that I wanted execute takes in a single argument -- a filename -- and makes a copy of the file with the line "This is a modified version." at the top of the new file. When I tested this program alone, it works and produces a new file.
Then I wrote the program to call the file:
public static void main(String[] args) {
try {
Process p = Runtime.getRuntime.exec("java Tester.java inputfilename.txt");
p.waitFor();
System.out.println("Done");
} catch(Exception e) {
System.out.println("Error");
System.exit(0);
}
}
The program above printed out "Done" but it never made a modified version of the file I passed in. I then put some println()'s in the other program. When I run that program alone, it printed out those statements, but when I tried to call it from the program above, it did not. How do I fix this?