Prev: Request Urgent Help - open directory to read contents, with Active Directory running
Next: Analyse the amplitude while recording a sound
From: Daku on 30 Dec 2009 10:12 Could some Java guru please help ? I am trying to port )from Linux to Windows) an application that will open directories and search for files with specific extensions inside. I have found that in Windows, to open a directory, I need to write, for example: File file = new File("C:\\temp\\"); However, hard-coded string literals are unaaceptable and I have to read in the directory names from a property file with entries as: srcdir=C:\\temp\\ ......... After the properties file is read in, if I do a System.out.println(..); I get the following to be displayed: C:\temp\ If I pass this string to the File constructor, the directory does not open. The question is how do I modify the String that is read in, so that when passed to the File constructor, it sees it as the literal "C:\\temp\\" Any hints, suggessstions would be of immense value. thanks in advance for your help. |