Generate SerialVersionUID in Intellij

In this post, we will see how to generate SerialVersionUID in Intellij.

There are multiple ways to do it. Let’s go through them.

Using find action

You can generate SerialVersionUID in intellij by pressing ctrl + shift +A(find action) and then typing Serializable class without serialVersionUID and toggle it from Off to On.

Generate SerialVersionUID using Action

Now create a class SerializableExample and it will implement Serializable
interface and generate serialVersionUID as below:

Generate SerialVersionUID in Class

Using Settings window

Navigate through following path:
File -> Settings -> Editor -> Inspections -> Java -> Serialization issues

and find Serializable class without serialVersionUID and check it.

generate serialVersionUID from Settings

Now create a class SerializableExample and it will implement Serializable interface and generate serialVersionUID as below:

Using Randomly Change serialVersionUID Initializer

You can also press Alt + Enter on following statement:

Put the cursor after = and press Alt + Enter to generate serialVersionUID in Intellij.

Generate serialVersionUID using variable

Using GenerateSerialVersionUID plugin

You can install GenerateSerialVersionUID plugin from the link.

Once you install this plugin, you can Right click -> Generate -> SerialVersionUID to generate SerialVersionUID in Intellij.

That’s all about how to generate SerialVersionUID in intellij.

Was this post helpful?

Leave a Reply

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