There is a version of the serialver
tool source available from OpenJDK. It all comes down to this call:
ObjectStreamClass c = ObjectStreamClass.lookup(MyClass.class);
long serialID = c.getSerialVersionUID();
System.out.println(serialID);
In JDK 6 at least it returns the same number with serialver
tool.