Saturday, 12 December 2015

How to generate serialVersionUID in Java?

Generate serialVersionUID of Employee class

public class Employee implements Serializable {
     private String name;
     public Employee(String name) {
  = name;
     public String getName() {
           return name;

1. serialver command
JDK has a build in command called “serialver” to generate the serialVersionUID automatically.

C:\Users\awadh\Desktop>serialver Employee
Employee:  private static final long serialVersionUID = -6607742892470200720L;

2. serialver tool

Run command: serialver –show
C:\Users\awadh\Desktop>serialver -show
Put the class description in the tool and click on the show button.
private static final long serialVersionUID = -6607742892470200720L;

3. Using Eclipse IDE

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...