Answer the question
In order to leave comments, you need to log in
Why can't resources from a jar file be loaded on my Windows?
Hello. Wrote a small program. In this program, I assign icons to the buttons. I take icons from the jar file itself. I write the path like this:
private static final String PATH_TO_IMAGE_RETURN = File.separator + "images" + File.separator + "cross.png";
Icon icon = new ImageIcon(getClass().getResource(PATH_TO_IMAGE_RETURN));
Answer the question
In order to leave comments, you need to log in
Resource paths are always separated by / regardless of the operating system.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question