title: How to get a path to a resource in a Java JAR file
body: <p>I am trying to get a path to a Resource but I have had no luck. </p>
  
  <p>This works (both in IDE and with the JAR) but this way I can't get a path to a file, only the file contents: </p>
  
  <pre><code>ClassLoader classLoader = getClass().getClassLoader();
  PrintInputStream(classLoader.getResourceAsStream("config/netclient.p"));
  </code></pre>
  
  <p>If I do this:</p>
  
  <pre><code>ClassLoader classLoader = getClass().getClassLoader();
  File file = new File(classLoader.getResource("config/netclient.p").getFile());
  </code></pre>
  
  <p>The result is: 
  <code>java.io.FileNotFoundException: file:/path/to/jarfile/bot.jar!/config/netclient.p (No such file or directory)</code></p>
  
  <p>Is there a way to get a path to a resource file?</p>