Loading Image External To Jar File

My directory structure looks like this:

/data/images

/lib/

I have a jar file in the lib folder that needs to access an image stored in the /data/images folder. I try using the following code:

BufferedImage img;

File newFile = new File(waypoint.geticonPath());

img = ImageIO.read(newFile);

However, I get the following error:

Exception in thread "AWT-EventQueue-1" java.lang.IllegalArgumentException: input == null!

at javax.imageio.ImageIO.read(Unknown Source)

Any suggestions? The images need to remain external to the jar file.

[596 byte] By [EdLaFavea] at [2007-11-27 5:00:34]
# 1
Should be noted that waypoint.geticonPath simply holds a string like "/data/images/filename.png"
EdLaFavea at 2007-7-12 10:17:18 > top of Java-index,Java Essentials,Java Programming...
# 2

> Should be noted that waypoint.geticonPath simply

> holds a string like "/data/images/filename.png"

Is "/data/images/filename.png" an absolute filepath? Try printing out the File's absolute path before trying to read it. If you use a relative path, you'd need to go up one to get out of lib before going down into data.

hunter9000a at 2007-7-12 10:17:18 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks, it works now. I was using a relative path. When I switched to an absolute path everything is fine.
EdLaFavea at 2007-7-12 10:17:18 > top of Java-index,Java Essentials,Java Programming...