This works fine for me. I do not escape them at all.
System.out.println(new File("/tmp/test 1/").exists());
Ensure you are useing the correct file separator for your operating system.
System.getProperty("file.separator")
More Related Contents:
- File I/O Concept [closed]
- Create a file from a photo URI on Android
- How do I save a String to a text file using Java?
- How to create a temporary directory/folder in Java?
- file.delete() returns false even though file.exists(), file.canRead(), file.canWrite(), file.canExecute() all return true
- How to read file from relative path in Java project? java.io.File cannot find the path specified
- Read large files in Java
- How to read file from end to start (in reverse order) in Java?
- Encryption of video files?
- How do I move a file from one location to another in Java?
- How to Write text file Java
- Best Way to Write Bytes in the Middle of a File in Java
- Read a file line by line in reverse order
- Mocking Files in Java – Mock Contents – Mockito
- How should I load files into my Java application?
- How to write and read java serialized objects into a file
- How to scan a folder in Java?
- Sort a file with huge volume of data given memory constraint
- How to convert InputStream to virtual File
- How to load and parse SVG documents
- How to send byte[] as pdf to browser in java web application?
- Change file owner group under Linux with java.nio.Files
- java read file from network device
- How to append data to a file?
- Create folder in Android [duplicate]
- Accessing a file inside a .jar file [duplicate]
- deleting folder from java [duplicate]
- How to read from files with Files.lines(…).forEach(…)?
- Eclipse – Show generated class files
- Read directory inside JAR with InputStreamReader