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
About

I am Vikram Aroskar working in the Java team based out of India.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today