I don\'t know much about Java. I\'m trying to read a file containing an int and various instances of a class called \"Automobile\". When I deserialize it, though, the progra
I fixed it in an easier way than the other answers -- my problem occurred when using the class in multiple projects.
If you have multiple projects, make sure that the specific class you're deserializing is in the exact same path! That means, the same package names etc inside that project. Otherwise it won't find it and cause the ClassNotFoundException
to be thrown.
So if it's in
/myPackage/otherPackage/Test.java
Then make sure, that path is exactly the same in your other project.