Basically, I want to include my main JFrame
's icon in the JAR file, so not to need to load it from an external location.
To achieve this, I searched about Java's resource system. What I have done with Eclipse:
I have created a new folder named "res":
I have copied the files inside it using Windows' explorer:
I have made that folder a source folder:
I have written this code:
URL url = ClassLoader.getSystemResource("/res/icona20.ico");
But url
is null
.
What did I do wrong?