i'm trying to make a small project in java with no luck if i'm compiling the program with eclipse everything is good, but when i'm i creating the jar file i get a blank window
this is the image i declared for:
public ImageIcon BACKGROUND = new ImageIcon() ;
I have tried to do the following stuff:
1.
new ImageIcon("Images/wood.jpg").getImage());
2.
this.BACKGROUND.setImage(Toolkit.getDefaultToolkit().getImage("Images/wood.jpg"));
3.
this.BACKGROUND = new ImageIcon(getClass().getResource("Images/wood.jpg"));
4.
/** Returns an ImageIcon, or null if the path was invalid. */
protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
1 & 2 showing the images after compiling and 3 & 4 returns null
another think is that i'm using mac and when i'm working with windows no image is displayed after compiling.