I'm writing a simple program that loads a conf file but it doesn't work (throws a FileNotFoundException if there are spaces in the path of the project (working on Windows Seven).
I checked by moving my project to another location without spaces in the path and it's working.
Question is, why doesn't it work and how can I prevent that to happen ? (I want to name my paths as I wish :p )
You shouldn't treat the resource as a File because it usually isn't - usually, resources are entries inside JAR files. Use getResourceAsStream instead of getResource, then use an InputStreamReader around the resulting InputStream: