import java.awt.*;
    import java.awt.image.BufferedImage;

    import javax.imageio.ImageIO;
    import javax.swing.*;

    import java.io.*;

    public class one extends JFrame {

        public one()
        {
            JPanel p = new JPanel();
            JLabel l = new JLabel();
            setTitle("ScrollText");
            setSize(600, 400);
            setLayout(new BorderLayout());
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setVisible(true);
            BufferedImage image;
            p.add(l);
            add(p);
            try
            {
                File file = new File("D://Photos//foto(222).jpg");
                image = ImageIO.read(file);
                l.setIcon(new ImageIcon(image));
            }
            catch( Exception e)
            {
                System.out.println(e.getMessage());
                l.setText("Cannot read image");
            }
        }

        public static void main(String[] args) 
        {
            new one();
        }
    }





This is my code..
when i run this code error appear..
javax.imageio.IIOException: Can't read input file!
    at javax.imageio.ImageIO.read(Unknown Source)
    at one.<init>(one.java:26)
    at one.main(one.java:40)
Can't read input file!


    Please give solution...

Make sure the path to the file is correct.

Rather than just printing the exception's messgae, do a full e.printStackTrace();
This will give you the details of any errors that caused the exception eg file not found, incorrect priveleges to read file etc etc

Where did the posted error message come from? The code must have had a call to printStackTrace() to create it. The posted code would not generate that message.

I think problem in java.io class.
i am use jdk1.6.0_33. in windows xp
this same problem comes in J2ME programing.
IO class is not load the files.
but using JFileChooser can load the Files.

I need any extra jar for IO or what i'm do for this problem?? .

The posted code works for me when I change the path to an image file on my PC.

ya thanx sir...
i find my mistake.
sorry for wrong.
my mistake is in path name.
it's now working..

i have another doubt.
for example integer array no of numbers..
as the same File array can store no of files inside the array.
it's possible or not..?
if possible please give the code..
i like File array Binding is runtime.

Sorry, I do not understand your question about arrays and files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.