Right, my program ran perfectly fine with the line
JLabel headerImage = new JLabel(new ImageIcon(img));
But as soon as i put it into a JAR file it has problems, i have searched the inet for soloutions and there isnt much out there for apps, loats for applets though, but none of the solutions seem to work. I currently have got this to work in the app but still wont work when i jar it up.
Image img = null;
try {
InputStream in = new InputStream(getClass().getResourceAsStream("./com/images/loginTitle.jpg"));
// Read from an input stream
img = ImageIO.read(in);
} catch (Exception e1) {
e1.printStackTrace();
}
JLabel headerImage = new JLabel(new ImageIcon(img));
Surly there is a way to access images stored within a jar file, they aren not in a seperate jar in the jar :confused: . They are simply in a package in the main JAR.
Any suggestions?