I used Launch4j
to create an .exe
file, and it runs fine. My program has some images that I load to be displayed, and in the .exe
they work. When I use Inno Setup to create an installer, it installs successfully - but the images don't appear. How can I fix that?
EDIT
I use the following code to load the images:
private JButton makeToolbarButton(String location, String tooltip, String altText, String key) {
String path = "" + location + ".png";
URL imageURL = getClass().getResource(path);
JButton button = new JButton();
button.getInsets().set(0, 0, 0, 0);
button.setToolTipText(tooltip);
button.setName(key);
if (imageURL != null) {
button.setIcon(new ImageIcon(imageURL, altText));
} else {
button.setText(altText);
System.err.println("Resource not found: " + path);
}
button.setFocusPainted(false);
return button;
}
and the button is constructed like this:
private JButton button1 = makeToolbarButton("/icon.png", "1", "button 1", "1");
It works in Eclipse, exported as a runnable jar, and as a .exe wrapped from Launch4j. It's just after making the Inno Setup installer that they don't load. The weird thing though is that the buttons are given an alt text to show if the images don't load, but the alt text doesn't show up either. Where the buttons should be, there's nothing. I was thinking it might be a layout problem but then why would it work as an application?