Wednesday, January 3, 2018

JAVA - How to use "serialver" tool (serialver.exe)

Every serializable class is in time of deserialization identified by its hash. The synonym for this value is serialVersionUID.

When you want to read class hash code, use tool serialver.exe. It is in your \java\jdk\bin directory.
I recommend you set this directory into your system path variable.

Suppose this class (Person.class file):
import java.io.Serializable;

public class Person implements Serializable {
          
  public Person() {}
      
  String name;
  int age;      
}
, then I can read class serialVersionUID:







When you make small change:
import java.io.Serializable;

public class Person implements Serializable {

public Person() {}

String name;
int age1;
}
, returned value is other:

No comments:

Post a Comment