How can I programmatically obtain the serialVersionUID for a class?
Created May 4, 2012
Tim Rohaly The following piece of code shows you how to do this
for the class java.lang.String:
String s = new String("test"); Class cl = s.getClass(); long uid = ObjectStreamClass.lookup(cl).getSerialVersionUID();The value of uid will be the same as the value printed out by serialver java.lang.String.