score:3

Accepted answer

as mentioned you seem to have added res as source folder, so it is a root, not to name, like src.

url url = classloader.getsystemresource("icona20.ico");

class loaders use an absolute (case-sensitive) path, without explicit leading slash /....

relative paths with an obligatory leading slash for absolute paths:

url url = xyz.class.getresource("/icona20.ico");

and you might prefer .png instead of .ico as the latter format is not standard in java se.

(about common practices.) the build tool maven uses as nice standard the following source folders:

/src/main/java/
/src/main/resources/
/src/test/java/
/src/test/resources/

your usage of res is reminiscent of ms visual studio ;).

score:3

the classloader will get the resources starting from each source folder you added to the classpath. therefore, the url should be the following:

url url = classloader.getsystemresource("icona20.ico");

Related Query

More Query from same tag