Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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.

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

package org.arpit.java2blog;

import java.io.Serializable;

public class SerializableExample implements Serializable {

    private static final long serialVersionUID = 7438255714694047836L;
}

Using Settings window

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

and find Serializable class without serialVersionUID and check it.

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

package org.arpit.java2blog;

import java.io.Serializable;

public class SerializableExample implements Serializable {

    private static final long serialVersionUID = 7438255714694047836L;
}

Using Randomly Change serialVersionUID Initializer

You can also press Alt +  Enter on following statement:

private static final long serialVersionUID = ;

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

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.



This post first appeared on How To Learn Java Programming, please read the originial post: here

Share the post

Generate SerialVersionUID in Intellij

×

Subscribe to How To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×