Reputation: 615
When i run the code below, the objIn.readObject(); throws a exception:
classNotFoundException project.Edge
The project.Edge is the object who i try to read from the file.
Object o = null;
ObjectInputStream objIn = null;
try {
objIn = new ObjectInputStream(new FileInputStream("objects.dat"));
o = objIn.readObject();
} catch (Exception ex) {
ex.printStackTrace();
}
while (o != null) {
//do stuff
}
Upvotes: 0
Views: 188
Reputation: 2369
Maybe your project.Edge
class not compiled correctly. Also check your classpath, this class must be available in your project.
Upvotes: 2
Reputation: 615
When you have this problem, check if the project.Edge is in the same package as when you write the binary file.
Upvotes: 0