-1

I have created images folder under src in Netbeans..to get image using following code in my application.

URL url = ClassLoader.getSystemClassLoader().getResource("/images/file.jpg");

logoimg=new ImageIcon(url);

but it is not loading any image..I have tried many of existed solutions in web, but no use.

My requirement is need to run my application jar in any system without missing images.

krish131
  • 163
  • 3
  • 14
  • possible duplicate of [Java in Eclipse: Where do I put files on the filesystem that I want to load using getResource? (e.g. images for an ImageIcon)](http://stackoverflow.com/questions/270197/java-in-eclipse-where-do-i-put-files-on-the-filesystem-that-i-want-to-load-usin) – Barett Jun 24 '15 at 17:07

1 Answers1

0

following code fixed my probelm

ImageIcon ImageIcon = new ImageIcon(getClass().getResource("/images/logo.png"));

krish131
  • 163
  • 3
  • 14