I am aware the question has been asked before. However, I have tried all the solutions and none seem to work. I have created a simple GUI program using javax.swing
, and of course it works perfectly in IntelliJ. However, its consequent jar file has quite a few issues. First and foremost, none of the images even display. I have been importing them as so:
img = new ImageIcon((ImageIO.read(new File("image_name.png"))));
I found a solution suggesting I use:
BufferedImage img = ImageIO.read(new FileInputStream("res/name.png"));
However, not only does it not load in the jar, it takes 5 seconds for the program to even launch in the compiler.
This is getting extremely frustrating, making this an executable.
If it's of any use, the JButton
components on the jar also don't seem to work. Whenever you click them, they remain pressed but nothing happens further.
I understand this isn't loads of info, but I would nontheless appreciate any help you can give. Thanks!