I don't know why but I cannot seem to get my head wrapped around paths in Java (I'm a Linux admin so that is my reference point). I have the following directory tree:
KCBSEvents
src
KCBSEvents
<Java class source files>
KCBSEvents.Images
<jpg Image files>
KCBSEvents.resources
<resource files>
In a class in KCBSEvents>src>KCBSEvents I am trying to read a jpg file from KCBSEvents.Images.
File file=new File("../KCBSEvents.Images/KCBSLogo.jpg");
try {
image=ImageIO.read(file);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
I am getting a can't read input file exception. Can someone help me figure out what the correct path should be? I don't understand why the path is wrong. The '..' goes up one level to 'src' and that is where KCBSEvents.Images lives. That jpg file is indeed in that directory. TIA.