Reading File In JAR using Relative Path
I have some text configuration file that need to be read by my program. My current code is: protected File getConfigFile() { URL url = getClass().getResource("wof.txt"); return new File(url.getFile().replaceAll("%20", " ")); } This works when I run it locally in eclipse, though I did have to do that hack to deal with the space in the path name. The config file is in the same package as the method above. However, when I export the application as a jar I am having problems with it. The jar exists on a shared, mapped network drive Z:. When I run the application from command line I get this error: