Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Serialization-deserialize with different JDK  RSS feed

 
Jaidev Haridas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java bean object (derived from JPanel). When I save this bean object in JDK1.2.2 and read it back using JDK1.3.1, a InvalidClassException is thrown.
Is there any way to maintain my file to be deserialized even when the jdk version changes? I have overridden the read and write Object methods and do not call defaultRead or write method. I also maintain a constant serialVersionUID. But, it sees the JPanel id and throws the exception.
Please let me know if there is any solution for this problem.
Thanks in advance,
Jaidev
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure you can. If you look at the API documentation, most objects serialized with one JDK are not compatable with a later one. I don't think you could change that without altering the classes that handle the deserialization.
Originally posted by Jaidev Haridas:
I have a java bean object (derived from JPanel). When I save this bean object in JDK1.2.2 and read it back using JDK1.3.1, a InvalidClassException is thrown.
Is there any way to maintain my file to be deserialized even when the jdk version changes? I have overridden the read and write Object methods and do not call defaultRead or write method. I also maintain a constant serialVersionUID. But, it sees the JPanel id and throws the exception.
Please let me know if there is any solution for this problem.
Thanks in advance,
Jaidev

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!