Link to home
Start Free TrialLog in
Avatar of bobwood2000
bobwood2000

asked on

error: serializable class does not declare a static final serialVersionUID field of type

I download some open source software, and now I'm try to open it in Ecplise. However, I get the following type of error 92 times. The only thing that is different about these error messages is the name of the class they apply to:

typical error message:
The serializable class CrawlHost does not declare a static final serialVersionUID field of type long

corresponding line:
public class CrawlHost implements Serializable {


Is the need for declaring a field name serialVersionUID specific to my version (1.5) of Java? Or, please tell me what you think this error message might mean.

Thanks.
Avatar of zzynx
zzynx
Flag of Belgium image

Avatar of cjjclifford
cjjclifford

Sun releases a program "serialver" to generate code for inclusion, which you run on your class in question (with the class in the classpath).
AFAIK, serialVersionUID is not mandatory, and if not provided will be added by the compiler (but in a broken fashion, in that each compile can result in a different one, even if the code is 100% identical!) - Is this a compile error with Java 1.5, or a warning?
serialVersionUID is not mandatory, but highly recomended.
ASKER CERTIFIED SOLUTION
Avatar of grim_toaster
grim_toaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bobwood2000

ASKER

Problem solved! Thank you.