Name
serialver — Class Version Number Generator
Synopsis
serialver [ -classpathpath]classnames... serialver [ -classpathpath] -show
Description
serialver displays the version number of a class or classes. This version number is used for the purposes of serialization: the version number must change each time the serialization format of the class changes.
If the specified class declares a long
serialVersionUID constant, the value of that field
is displayed. Otherwise, a unique version number is computed by
applying the
Secure Hash Algorithm (SHA) to the
API defined by the class. This program is primarily useful for
computing an initial unique version number for a class, which is then
declared as a constant in the class. The output of
serialver is a line of legal Java code, suitable
for pasting into a class definition.
Options
-
-classpathpath Specifies the search path for classes.
-
-show When the
-showoption is specified, serialver displays a simple graphical interface that allows the user to type in a single class name at a time and obtain its serialization UID. When using-show, no class names can be specified on the command line.
Environment
-
CLASSPATH serialver is written in Java, so it is sensitive to the
CLASSPATHenvironment variable in the same way the java interpreter is. The specified classes are looked up relative to this classpath.
See also
java.io.ObjectStreamClass
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access