Main Tutorials

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

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
9 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Dirk Ulrich
2 years ago

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.

victor
1 year ago
Reply to  Dirk Ulrich

thx

Ranjan Singh
3 years ago

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

klaillton
3 years ago

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

Dirk Ulrich
2 years ago

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

Kbirhan
2 years ago

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

Kbirhan
2 years ago
Reply to  Kbirhan

* File -> Settings -> Editor -> Inspections -> Jvm -> Serialization issues:

Fogo
2 years ago

Nice

Ian
3 years ago

Thank you!