0

I'm currently trying to execute a cmd in an external directory using ProcessBuilder. When I convert my URL to a File, a method in the File class that removes redundancies (File.fs.normalize) is called and reduces the "//" that I need in the "https://" of my directory to "/".

ProcessBuilder pb = new ProcessBuilder("cmd", 
    "/C", 
    "svn", 
    "status", 
    "-v", 
    "|", 
    "findstr", 
    "/R", 
    "^C");
String svnstr = mergeUrl.toString();
File q = new File(svnstr);
pb.directory(q);
Process p = pb.start();

And I am receiving this error:

java.io.IOException: Cannot run program "cmd" (in directory "https:\www.example.com\Archival-rel20.3"): CreateProcess error=267, The directory name is invalid  

Is there anyway to salvage the URL address when converting to a File? The only other option I've found would be to use Runtime, which also passes a File as a directory parameter?

olivialarson
  • 31
  • 1
  • 6
  • What is the value of `mergeUrl`? – mattbdean Jul 12 '13 at 15:54
  • @whowantsakookie looks that is `https:\www.example.com\Archival-rel20.3` (taken from stacktrace). – Luiggi Mendoza Jul 12 '13 at 15:55
  • It's a valid https:// path. – olivialarson Jul 12 '13 at 15:55
  • The problem is here: `File q = new File(svnstr);` and the stacktrace is explicit about this: *The directory name is invalid* for being `https:\www.example.com\Archival-rel20.3`. – Luiggi Mendoza Jul 12 '13 at 16:02
  • Right. I've changed the directory to a generic for this post, but it's a valid directory that is being loaded from 'mergeUrl', it's just missing the second backslash. – olivialarson Jul 12 '13 at 16:43
  • Hope that helped you to solve the problem. – Luiggi Mendoza Jul 12 '13 at 23:03
  • Essentially you just paraphrased my question. I am looking for a solution to get the File initialization to keep my double backslash, preferably without overriding the File class. As mentioned, the normalize method within the FileSystem class (that is called by the File constructor) removes path redundancy. Any thoughts to a work around that would allow me to have a File variable with a "//" in the path? – olivialarson Jul 13 '13 at 13:05
  • Problem is fixed. Wasn't able to utilize the URL as the directory, but I found a local Subversion working copy in the Jenkins workspace. – olivialarson Jul 19 '13 at 12:35

0 Answers0