How to generate serialVersionUID in Intellij IDEA

In IntelliJ IDEA, we need to enable this auto-generate serialVersionUID option manually.

P.S Tested with IntelliJ IDEA 2019.3.4, it should work the same in other versions.

Intellij IDEA Settings

File -> Settings -> Editor -> Inspections -> Java -> Serialization issues:

Find serialization class without serialVersionUID and check it.

Inspections

Back to the editor, clicks on the class name, ALT + ENTER (Windows), it will prompts the Add serialVersionUID field option.

Serialization issues

A new serialVersionUID is auto-generated.


public class Address implements Serializable {

    private static final long serialVersionUID = -2338626292552177485L;

}

Done.

References

9 comments on “How to generate serialVersionUID in Intellij IDEA

  1. In IntelliJ IDEA 2021.3 (Ultimate Edition) it’s moved to IntelliJ IDEA -> Preferences -> Editor -> Inspections -> JVM languages
    Maybe better approach:
    Double pressing [Shift]. In the appearing dialog chose the Actions menu and type ‘Serializable class without’ and select the item to toggle it on/off.

    Reply
  2. In IntelliJ IDEA 2021.3 (Ultimate Edition) it’s moved to IntelliJ IDEA -> Preferences -> Editor -> Inspections -> JVM languages

    Reply
  3. it has been moved to File -> Settings -> Editor -> Inspections -> Jbm -> Serialization issues:

    Reply
    1. * File -> Settings -> Editor -> Inspections -> Jvm -> Serialization issues:

      Reply
  4. Thank you, I’m starting with Intellij and this is very tricky

    Reply
  5. Thank you. Quite helpful, since in my terminal for serialver, it was showing – command not found : serialver

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *