I'm trying to acces a File inside the .jar. In Netbeans, this:
System.out.println(new File(this.getClass().getResource("Image.jpg").getFile()).exists()); Prints out:
true After building however, it prints false.
The file is definitely in the .jar, next to the .class file, and something like this:
new Frame(){ @Override public void paint(Graphics g){ try{ g.drawImage(ImageIO.read(this.getClass().getResource("Image.jpg")), 0, 0, this); } catch(Exception e){e.printStackTrace();} } }.setVisible(true); does paint the image after building.
How can I acces the Image.jpg as a File object?