Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serialization and VM

 
M Mistroni
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
suddenly i m having a doubt about serialization and cannot find answers on the net.
If i serialize an object using JVM1, and then try to deserialize it using JVM2, will it work?
i mean, serialization / deserialization works across different java virtual machines?
i m guessing that answer is yes...

thanks and regards
marco
 
Mujahid Al-okaidi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember a question on this in the exam and I think the answer was yes.
 
Antonio Tercero
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it works.
When you serialize an object to a file in one JVM you can deserialize that object from another JVM (simply reading the file).
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by M Mistroni:
hi all,
suddenly i m having a doubt about serialization and cannot find answers on the net.
If i serialize an object using JVM1, and then try to deserialize it using JVM2, will it work?
i mean, serialization / deserialization works across different java virtual machines?
i m guessing that answer is yes...

thanks and regards
marco


Yes you can do that. That is the purpose of serialization. You can also serialize and deserialize across different versions of the JVM as long as the serialversionuid is overridden and the JVM loading the class has a version that is the same or higher than the JVM that serialized the class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic