title: Reading File In JAR using Relative Path
body: <p>I have some text configuration file that need to be read by my program.  My current code is:</p>
  
  <pre><code>protected File getConfigFile() {
      URL url = getClass().getResource("wof.txt");
      return new File(url.getFile().replaceAll("%20", " "));
  }
  </code></pre>
  
  <p>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:</p>
  
  <p>java.io.FileNotFoundException: file:\Z:\apps\jar\apps.jar!\vp\fsm\configs\wof.txt </p>
  
  <p>How can I get this working?  I just want to tell java to read a file in the same directory as the current class.</p>
  
  <p>Thanks,
  Jonah</p>