is there a way to throw an exception with
ImageIO.read(getClass().getResourceAsStream("images/castle.jpg")))
This solves my problem with reading images from a .jar file. But the problem is it doesn’t throw an exception.
It is weird that read throws an exception for
ImageIO.read(new File(getClass().getResourceAsStream("images/castle.jpg").toString()))
Is there a way? I have tried to make it work for eclipse and .jar but nothing works!
And I hate to keep checking for nulls
Thanks
are you meaning Exceptions ?, for example