troubleshooting Question

Class not found - ObjectInputStream

Avatar of James_h1023
James_h1023Flag for United Kingdom of Great Britain and Northern Ireland asked on
Java
11 Comments2 Solutions363 ViewsLast Modified:
Hi,

I have the attached code to access a file I have serialized using another programme.

Although I get ClassNotFoundException: DataStore on the line 'data = (DataStore) ...'
This happens when i replace the cast with CG2FishEye.DataStore which includes the package the class is in.

Any Suggestions
Thanks
James
DataStore data = null;
           FileInputStream fis = null;
           ObjectInputStream in = null;
           try {
                fis = new FileInputStream(fileChooser.getSelectedFile());
                in = new ObjectInputStream(fis);
                data = (DataStore) in.readObject();
                in.close();
            }
            catch(IOException ex) {
                ex.printStackTrace(); }
            catch(ClassNotFoundException ex) {
                ex.printStackTrace();
            }

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros