The following code is running successfully in BlueJ IDE, but not in Eclipse.
String path="images/pic1.jpg";
BufferedImage myPicture = null;
try {
myPicture = ImageIO.read(new File(path));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
My image path is same in both the IDE. Also, I observed directory structure is same for *.class file and image files.
Why this happens in eclipse only?
You must use
System.getProperty("user_dir")+File.separator+"image"+File.separator+"im0001.jpg";