I have a java/maven project that uses tango icons, so I'm using the following dependency:
<dependency>
<groupId>org.freedesktop.tango</groupId>
<artifactId>tango-icon-theme</artifactId>
<version>0.8.90</version>
</dependency>
And the following code, which would work ok before I moved the proyect to maven:
imageIcon = new ImageIcon(this.getClass().getResource(org/freedesktop/tango/22x22/actions/address-book-new.png));
However, it now results in NullPointerException for some reason. The generated jar does not contain the images, nor reference them in any way, but classes in other jars are.
I've investigated a lot, but I've found most people bundle their images with their source. This isn't my case.
What do I need to do for maven to reference and/or package these images propertly? How can I get maven to build a standalone runnable jar (this is a swing application).
If you add a slash before the path it works:
From the API: