-1

im getting the "Can't read input file!" in next chunk of code

try {
            slate = ImageIO.read(new File("flor.jpg"));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

why is that happening if the image is in the same place with the .java file ?

Sole Panic
  • 19
  • 6

2 Answers2

1

Run below code to check if your image is listed current directory

File file = new File(".");
for(String fileNames : file.list()) System.out.println(fileNames);
sanjeevRm
  • 1,541
  • 2
  • 13
  • 24
0

for example: if you project: test in eclipse

test
----src/*.java
----flor.jpg
timhu
  • 98
  • 4