I can't seem to get this right...
I have a Java project in Eclipse called MyProject. In its root is the folders bin, src, and resources. Inside of resources, I have an image named myImage.gif
.
In my code, I want to use this image, and I want it to work whether or not this is running from a Jar file. I currently am doing this
ImageIcon j = new ImageIcon(getClass().getResource("/resources/myImage.gif"));
but it is spitting out a null when I run it through Eclipse (not as a Jar).
What is the right way to do this?