title: LWJGL 3 stbi_load_from_memory not working when in jar
body: <p>I am following along with a tutorial book on LWJGL3 and I tried to make my own image loading code (The book code does not use the STB library) and it works perfectly fine when the project is run normally (IntelliJ IDE, run directly from the build folder), It loads the image from into the ByteBuffer and <code>stbi_load_from_memory</code> works fine, but as soon as it is compiled and put in a jar file it just stops working, Even tho the image was successfully loaded into the ByteBuffer, as if the <code>stbi_load_from_memory</code> function just returns null if it's in a Jar.</p>
  
  <p>The code:</p>
  
  <pre><code>public static ByteBuffer loadImage(String fileName, IntBuffer w, 
      IntBuffer h, IntBuffer comp) throws Exception
      {
          ByteBuffer image;
          //the class name is Utils
          InputStream imageFile = 
          Utils.class.getResourceAsStream(fileName); 
  
          //The image data gets put into the byte array no matter if
          //its a jar or not
          byte[] imageData = new byte[imageFile.available()];
          imageFile.read(imageData);
          ByteBuffer imageBuffer = 
          BufferUtils.createByteBuffer(imageData.length);
          imageBuffer.put(imageData);
          imageBuffer.flip();
          //imageBuffer is the right size and has the right contents            
  
          //This is where everything fails if its in a jar,
          //image is set to null and the Exception is thrown
          image = stbi_load_from_memory(imageBuffer, w, h, comp, 0);
  
          if(image == null)
          {
              throw new Exception("Failed to load image: " + fileName);
          }
  
          return image;
      }
  </code></pre>
  
  <p>It can't be a misspelled file name or recourse path, because it loads the data into the array properly no matter if it's a jar or not.</p>
  
  <p>Additional Information:</p>
  
  <ul>
  <li><p>Java version: 1.8.0_131 64bit</p></li>
  <li><p>Processor architecture: amd64</p></li>
  <li><p>IDE version (if needed for some reason): IntelliJ 2017.1.4 Ultimate</p></li>
  <li><p>OS: Ubuntu 16.04 LTS 64 bit</p></li>
  <li><p>Kernel: Linux 4.8.0-58-generic amd64</p></li>
  <li><p>LWJGL version: 3.1.2</p></li>
  <li><p>The project is made in Gradle 3.3</p></li>
  <li><p>if required i will upload and post the link of the entire source code</p></li>
  </ul>