0

Hi I have a jar file and I am trying to move it to another computer. Images are saved in a folder called SavedImages so I copied that folder and put it on the desktop. I changed the path before creating the jar file. I am getting a javax.imageio.IIOException: Can't read input file!

The path is definitely correct. Any idea what I am doing wrong. Here is an example of the code:

chosen = resize(ImageIO.read(new File("C:\\Users\\Mario\\Desktop\\SavedImages\\Chosen.png")),30,30);
Mario
  • 1
  • 3
  • 1
    Works here, `ImageIO.read` works for an existing `File`. Please [edit] your question and show us the complete stack trace. –  Jul 22 '19 at 14:31
  • Possible duplicate of [imageio.IIOException: Can't read input file](https://stackoverflow.com/questions/18309868/imageio-iioexception-cant-read-input-file) – George Z. Jul 22 '19 at 14:34
  • I would consider changing the code to use a system property so you can just pass the path to the jar at runtime rather than just always using a hardcoded string – Toofy Jul 22 '19 at 14:37
  • Your file path is **not** correct. Try creating the `File` first and checking that it exists: `System.out.println(file.exists());`. You say you moved it to another computer...are you sure that computer doesn't have a different user name other than "Mario?" – Zephyr Jul 22 '19 at 15:05
  • It does say it exists actually - file.exists() returns true – Mario Jul 22 '19 at 17:17

0 Answers0