I have searched for a while now for a fix to this. I have a project folder in my workspace (that folder is basically my root), and in it there is a file called icon.gif. In my program, I have the following:
package com.mgflow58.Main;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
public class Game {
public static void main(String[] args) {
JFrame window = new JFrame("Guppy's Adventure");
window.add(new GamePanel());
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setResizable(false);
window.pack();
window.setLocationRelativeTo(null);
window.setVisible(true);
window.setIconImage(new ImageIcon("icon.gif").getImage());
}
}
The icon works fine in eclipse when I run it, but the exported jar file does not display the icon as it does in eclipse. Any idea why? I'm going crazy trying to figure this out.