Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IIOException.

0 views
Skip to first unread message

Lando

unread,
Feb 7, 2003, 11:26:30 AM2/7/03
to
I'm a beginner and I'm trying to copy an image file.
and I get this Exception .The file exists and the path
is OK .What is wrong ?
Thanks in advance.Regards, Lando

Exception in thread "main" javax.imageio.IIOException: Can't read input
file!
at javax.imageio.ImageIO.read(ImageIO.java:1196)
at TabbedPaneDemo$HeadSpin.<init>(TabbedPaneDemo.java:125)
at TabbedPaneDemo.<init>(TabbedPaneDemo.java:36)
at TabbedPaneDemo.main(TabbedPaneDemo.java:32)

>>>>>>>>>>
File f = new File("C:/PgmJava/images/duke0.gif");
BufferedImage bi = ImageIO.read(f);
BufferedImage output = new BufferedImage (200,300,
BufferedImage.TYPE_INT_ARGB);
output = ImageIO.read(f);
// Save
File outputFile = new File("C:/PgmJava/image.png");
ImageIO.write(output, "PNG", outputFile);


Kenneth Rose

unread,
Feb 7, 2003, 4:09:57 PM2/7/03
to
I'm assuming you're running on Windows.
You have the line:

File f = new File("C:/PgmJava/images/duke0.gif");

Try

File f = new File("C:\\PgmJava\\images\\duke0.gif");

And of course, make sure that the file duke0.gif actually exists at that
location.

/<en

Mark Thornton

unread,
Feb 7, 2003, 5:07:39 PM2/7/03
to

"Kenneth Rose" <ken...@rogers.com> wrote in message
news:b217b5$uib$1...@tabloid.uwaterloo.ca...

> I'm assuming you're running on Windows.
> You have the line:
>
> File f = new File("C:/PgmJava/images/duke0.gif");
>
> Try
>
> File f = new File("C:\\PgmJava\\images\\duke0.gif");
>
> And of course, make sure that the file duke0.gif actually exists at that
> location.

Windows will quite happily accept either form of file separator, as will
Java when running on Windows. So your suggested change will have no effect.

Mark Thornton


Lando

unread,
Feb 8, 2003, 10:55:28 AM2/8/03
to

"Mark Thornton" <m.p.th...@ntlworld.com> ha scritto nel messaggio
news:b21ank$184pou$1...@ID-139894.news.dfncis.de...


Sorry, it was my fault.
Thanks a lot,regards Lando.


0 new messages