I have a File object that points to an executable. I also have a File object that points to a text file. I need to execute the program with the text file as an argument. I am using the exec method of the Runtime class to do this, but when I try to escape any spaces in the paths I get two backslashes in the command and it fails. If I print the command out it looks fine. Any Ideas?
the regex version replaceAll yeilds the same results
Code:
String exe = exeFile.getAbsolutePath().replace(" ","\\ ");
String file = inFile.getAbsolutePath().replace(" ","\\ ");
Process p = Runtime.getRuntime().exec(exe + " " + file);
the regex version replaceAll yeilds the same results