'Difficulty in retrieving Image with URL in a Java .JAR

I'm attempting to retrieve an image for a Java Swing icon. I followed some advice here on SO to use URLs to retrieve it from a jar, but I am getting a null URL:

URL iconUrl = this.getClass().getResource("/buildings/"+buildingEnum.getColor().toString()+".png");
Toolkit tk = this.getToolkit();
Image img = tk.getImage(iconUrl);

My .JAR structure looks like this. I built it using Gradle and ShadowJar.

enter image description here

Both running it through IntelliJ and as an actual .jar in Powershell failed to retrieve it properly.

Is there something I'm missing? Please let me know if there's any additional information I need to provide.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source