I am trying to load a binary image file to do some processing inside my server-side Java code. I am currently placing my image in the package where my executing class exists and calling:
Image img = Image.getInstance(this.getClass().getResource("logo.png"));
This works fine when I'm running Tomcat on my development box in an exploded war setup, but when I deploy to a server running Tomcat where it doesn't explode war files, the call to getResource returns null.
I've also tried moving the image to my context root and accessing it like this:
Image img = Image.getInstance(this.getClass().getResource("/../../logo.png"));
Again, this works on my development box, but not when I deploy it elsewhere.
Is there a better way to access this file? What am I doing wrong?
Thanks!!