M
minjie
I'm very new to Java, so please excuse me if the quesions are too
trivial.
I want to invoke a process with the following:
------
ProcessBuilder pb = new ProcessBuilder("crw32.exe",
"myreport.rpt");
pb.directory("C:\Program Files\Crystal Decisions\Crystal
Reports 9\"); // <-- error
Process p = pb.start();
------
But I got the error "Illegal escape character". If I change that
statement to:
pb.directory("C:\\Program Files\\Crystal Decisions\\Crystal
Reports 9\\");
I got the error:
"cannot find symbol.
symbol : method directory(java.lang.String)".
Isn't directory() a method in ProcessBuilder class (I'm using Java
1.5)? Is the error due to the fact that I still don't have the correct
path defined in there? How should I define that directory? Is it OK if
there are spaces in the path?
Also, how do I define the directory for the file "myreport.rpt" as
"C:\My Reports\", if I've already defined a directory to be "C:\Program
Files\Crystal Decisions\Crystal Reports 9" for the command "crw32.exe"?
Thanks.
trivial.
I want to invoke a process with the following:
------
ProcessBuilder pb = new ProcessBuilder("crw32.exe",
"myreport.rpt");
pb.directory("C:\Program Files\Crystal Decisions\Crystal
Reports 9\"); // <-- error
Process p = pb.start();
------
But I got the error "Illegal escape character". If I change that
statement to:
pb.directory("C:\\Program Files\\Crystal Decisions\\Crystal
Reports 9\\");
I got the error:
"cannot find symbol.
symbol : method directory(java.lang.String)".
Isn't directory() a method in ProcessBuilder class (I'm using Java
1.5)? Is the error due to the fact that I still don't have the correct
path defined in there? How should I define that directory? Is it OK if
there are spaces in the path?
Also, how do I define the directory for the file "myreport.rpt" as
"C:\My Reports\", if I've already defined a directory to be "C:\Program
Files\Crystal Decisions\Crystal Reports 9" for the command "crw32.exe"?
Thanks.