Check the validity of a .class file

Keith McGuigan Keith.McGuigan at Sun.COM
Thu Nov 20 13:41:05 PST 2008


Mario Mendez-Lojo wrote:
> Hi guys,
> 
> I'm manipulating bytecode using the Soot tool. However, sometimes I'll 
> output bytecode that is incorrect (Soot is not able to detect this): 
> local variables declared as of void type, for instance. The transformed, 
> invalid class will make the JVM crash.
> 
> The question is: is there any tool that can check whether a .class file 
> is in the right format?

Are you running without the JVM's verifier turned on?  With the 
verifier, the VM should kick out with a VerifyError or ClassFormatError 
if there's any problem with the classfile format or bytecode.  It should 
be on by default, but you can run with 'java -verify' just to be sure.

If the JVM crashes when you feed it a bad classfile, please send the 
classfile to me for diagnosis.  This should not happen and would likely 
be a bug in the JVM.

--
- Keith



More information about the hotspot-dev mailing list