Java - ClassNotFoundException I have the class included, but why do I get an exception?

Posted by aloh on Stack Overflow See other posts from Stack Overflow or by aloh
Published on 2010-03-11T21:01:24Z Indexed on 2010/03/11 21:04 UTC
Read the original article Hit count: 120

Filed under:
public static Reservation[] openBinaryFile( String fileName )
{
    Reservation [] objArray = null;

    try
    { 
        ObjectInputStream inStream = new ObjectInputStream(
            new FileInputStream( fileName ) );

        objArray = (Reservation[])inStream.readObject();

        inStream.close();
    }
    catch( ClassNotFoundException e )
    {
        System.out.println( "Exception: ClassNotFoundException." );
    }

I have the class included, but why do I get an exception? The class is in the same package as the others. Why am I getting this exception?

© Stack Overflow or respective owner

Related posts about java