Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting around an invalidClassException

 
Paul Bailey
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting an InvalidClassException when i read in an object, when i first open the object input stream.
i.e. i have a class that i worte forever and a day ago, and i was saving files with one of these serialized in it, and then recently, i added an extractor to the class, and now when i even try to open an object input stream with one of these it gets mad and says java.io.InvalidClassException: my.class.name.here; local class incompatible: stream classdesc serialVersionUID = 13457817857854345, local classserialVersionUID = 23523513453453245
what can i do?
i don't care about reading in this class, i just want the rest of the stuff to go through an object input stream.
Any ideas?
 
Paul Bailey
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is here
http://www.acm.org/crossroads/xrds4-2/serial.html
one simply has to include a line like this
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!