How can I find out the serialVersionUID of a serialized Java object?

前端 未结 3 1359
春和景丽
春和景丽 2021-02-13 16:28

I have several serializable classes that were compiled without specifying a serialVersionUID. I now need to add some data members to these classes but wish to preserve some alre

3条回答
  •  滥情空心
    2021-02-13 17:03

    What I usually do is, I compile the code, try to run it, and the raised exception mentions the offending SVUID, so I can cut and paste it in my own code. Crude, but it works.

提交回复
热议问题