The easiest way is to use Unix-style paths in Java. Java will figure out what are the real paths in all file-based code.
System.out.println(new File("c:/dev/m2-repo/org/apache/ant").getCanonicalPath());
Output:
C: \ DEV \ m2 repo \ org \ Apache \ ant
By the way, if this is the root drive, you can skip the drive letter. Java will understand /programs if you are looking for C:\programs
Sean Patrick Floyd
source share