Reflections

Tuesday Apr 01, 2008

serialver or serialver.exe

In the ${JAVA_HOME}/bin/ folder there is a executable file serialver.

What does this file do?
This file is used to find out whether a class is Serializable or not.

Just use it like a normal java <classname>.

Look at the sample code below.
Obviously the same thing works on any other OS.

bash$pwd
/Java/jdk1.6.0_10/bin

bash$cat Class1.java

public class Class1 {

}

bash$cat Class2.java
import java.io.*;
public class Class2 implements Serializable{

}

bash$serialver Class1
Class Class1 is not Serializable.

bash$serialver Class2
Class2: static final long serialVersionUID = 8006342768338701979L;

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers