Results 1 to 5 of 5
Thread: ImageIO exception problem
- 07-06-2011, 08:47 AM #1
Senior Member
- Join Date
- Jul 2011
- Location
- Melbourne, Victoria, Australia
- Posts
- 155
- Rep Power
- 2
ImageIO exception problem
I have this try{ statement to load an image:
My problem is that even after NetBeans asks me to put this block in a try-catch and it does that, it just keeps asking me to put this block of code in a try-catch. Why?Java Code:try { File file = new File("image.jpg"); Image img = ImageIO.read(file); } catch (IOException ex) { Logger.getLogger(Paint.class.getName()).log(Level.SEVERE, null, ex); }
- 07-06-2011, 09:56 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
What exactly is NetBeans saying.
Because it will also be telling you what exception it thinks you are not currently catching.
- 07-06-2011, 10:00 AM #3
Senior Member
- Join Date
- Jul 2011
- Location
- Melbourne, Victoria, Australia
- Posts
- 155
- Rep Power
- 2
Yes, thanks i have fixed that now. I put it in its own method and it seems to be working but now the image still wont paint.
- 07-06-2011, 10:55 AM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,560
- Rep Power
- 11
You might want to check that the file .exists() and, if it doesn't, print the full path that you are looking at when you call new File("...").
- 07-06-2011, 11:52 AM #5
Senior Member
- Join Date
- Jul 2011
- Location
- Melbourne, Victoria, Australia
- Posts
- 155
- Rep Power
- 2
Similar Threads
-
How to install com.sun.media.imageio.plugins
By Shellback3 in forum EclipseReplies: 0Last Post: 05-12-2011, 06:01 PM -
Error with ImageIO
By stegano in forum New To JavaReplies: 4Last Post: 03-31-2011, 03:59 PM -
BufferedImage, ImageIO and Jar files
By satory in forum New To JavaReplies: 6Last Post: 05-23-2010, 12:07 AM -
Trouble with ImageIO
By sari in forum New To JavaReplies: 1Last Post: 03-30-2009, 09:42 PM -
Help with ImageIO
By romina in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 05:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks