title: Java get resource InvalidJarIndexException
body: <p>I have a class names test.java and another file "log4j.properties" in the same folder but following call</p>
  
  <pre><code>getClass().getResource("log4j.properties")
  </code></pre>
  
  <p>fails with </p>
  
  <pre><code>ms
  Trace:
  sun.misc.InvalidJarIndexException: Invalid index
      at sun.misc.URLClassPath$JarLoader.getResource(Unknown Source)
      at sun.misc.URLClassPath$JarLoader.getResource(Unknown Source)
      at sun.misc.URLClassPath$JarLoader.findResource(Unknown Source)
      at sun.misc.URLClassPath.findResource(Unknown Source)
      at java.net.URLClassLoader$2.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findResource(Unknown Source)
      at java.lang.ClassLoader.getResource(Unknown Source)
      at java.lang.ClassLoader.getResource(Unknown Source)
      at java.lang.Class.getResource(Unknown Source)
  </code></pre>
  
  <p>But getClass().getClassLoader().getResource("log4j.properties") works. What can be the reason?</p>