++ tailor filepaths to operating system linux java windows file path how to make it so that the same java program can handle file paths directories for both windows and linux is there a java utility which will convert a string path to use the correct file http://stackoverflow.com/questions/1697303/is-there-a-java-utility-which-will-convert-a-string-path-to-use-the-correct-file use file.separator or the Path class String rootStorePath = Paths.get("c:/projects/mystuff/").toString(); If you are creating a new file, use file.separator String new_directory_for_new_files = directory+File.separator+"new directory"; ------------ Note that to use file separators in a regular expression that will work in any operating system use Pattern.quote(File.separator) ^ http://stackoverflow.com/questions/242792/escape-path-separator-in-a-regular-expression