LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

serialver

Compute Java serialization version UID

TLDR

Get serial version UID
$ serialver [ClassName]
copy
With classpath
$ serialver -classpath [path] [ClassName]
copy
Show for JAR class
$ serialver -classpath [app.jar] [com.example.MyClass]
copy

SYNOPSIS

serialver [-classpath path] [options] classname

DESCRIPTION

serialver computes and displays the serialVersionUID for Java classes that implement the Serializable interface. This UID is a hash derived from the class structure (fields, methods, interfaces) and is used by Java's serialization mechanism to verify that sender and receiver of a serialized object have compatible class definitions.When a class does not explicitly declare a serialVersionUID, the JVM computes one automatically at runtime. Using serialver to obtain and hardcode this value in the class source prevents incompatible class version errors when the class structure changes in ways that remain compatible with older serialized forms.

PARAMETERS

-classpath PATH

Class search path.
-J FLAG
Pass option to the Java runtime (e.g., -J-Xms48m).
-show
Show GUI inspector (removed in modern JDK versions).

CAVEATS

Class must implement Serializable. JDK required. The -show GUI mode has been removed in recent JDK versions.

HISTORY

serialver is part of the Java Development Kit, providing serial version UID computation for Serializable classes.

SEE ALSO

java(1), javac(1), jar(1)

Copied to clipboard
Kai