Sunday, January 16, 2011

Serialization and Deserialization from seperate projects in Java(NetBeans)

As we all know serialization and deserialization is one of the most important functionality in Java.In
serialization we can store and retrieve objects from object file.In some incidents we need to store a objects from one project and retrieve them from another project.I try this in netbeans IDE.I hope this will work on other IDEs also.I hope you have a undersatnd about how to serialize and deserialize objects in java.Use same package structure for both projects.As I explain how to do this.It's a small trick.Try it.(Other wise you get Java no class found exception in your deserialization).:)

Sometimes you have to add this line in a both classes in both projetcs.
private static final long serialVersionUID = 4579794556713L;

(No is any number you want.Both lines in seoerate projetcs should be identical)

No comments:

Post a Comment