I have an issue with Eclipse 3.6 (Helios) :
Anytime I want to generate a serial version ID (serialVersionUID
) for a class that extends a serializable
class, I get the following message :
The following error occured : Could not find class file. Make sure the file is compilable.
What am I doing wrong ?
Thank you.
File -> Settings -> Editor -> Inspections -> Java -> Serialization issues : Find serialization class without serialVersionUID and check it. Back to the editor, clicks on the class name, ALT + ENTER (Windows), it will prompts the Add serialVersionUID field option. A new serialVersionUID is auto-generated.
For Eclipse IDE, move the mouse over the serialization class, or click on the serialization class and press CTRL + 1 .
The SerialVersionUID must be declared as a private static final long variable in Java. This number is calculated by the compiler based on the state of the class and the class attributes. This is the number that will help the JVM to identify the state of an object when it reads the state of the object from a file.
SerialVersionUID is a unique identifier for each class, JVM uses it to compare the versions of the class ensuring that the same class was used during Serialization is loaded during Deserialization. Specifying one gives more control, though JVM does generate one if you don't specify.
In my case, I've solved this problem by the following way:
Right click the project, "Build Path" -> "Configure Build Path" -> "Source" tab, remove paths tagged "missing".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With