load png into BufferedImage

HiHow can I load a png image into a BufferedImage?This not working for me:File file = new File("myfile.png");BufferedImage input = ImageIO.read(file);thx.
[196 byte] By [LKovaria] at [2007-11-26 20:28:35]
# 1

import javax.imageio.*;

try

{

BufferedImage image= new BufferedImage();

image=(BufferedImage)ImageIO.read(new File("imaje.png"));

}

catch (Exception ex) {}

i hope i helped you

Message was edited by:

danjavatrix

Message was edited by:

danjavatrix

danjavatrixa at 2007-7-10 1:17:21 > top of Java-index,Security,Cryptography...
# 2

> i hope i helped you

No you didn't.

Your code has the biggest amount of errors I have ever seen for 2 lines of code.

It's much more simple:

BufferedImage image = ImageIO.read(new File(....));

If this doesn't work then you need to catch the Exception and figure out where the problem is.

Probably the path to the file is wrong.

Rodney_McKaya at 2007-7-10 1:17:21 > top of Java-index,Security,Cryptography...