ClassFileAnalyzer (Can)
Analyzer and Disassembler (Jasmin syntax 2) for Java class files.
Downloads    Usage    Examples    Contact/Impressum    Disclaimer


This software is an analyzer and disassembler (Jasmin syntax 2, for Java class files and is based on the specification of the Java Virtual Machine (Chapter: The class File Format). ClassFileAnalyzer is released as free software, provided under the terms of the GPL 2.0.




This software is licensed under the CC-GNU GPL.

de.gif Diese Software fällt unter den Lizenzvertrag CC-GNU GPL.
Die Software ist ein Analyseprogramm und ein Disassembler für Java-Klassendateien - siehe auch und






HelloWorld Example

/* */

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello World!");    


> javac
  --> HelloWorld.class
> java ClassFileAnalyzer HelloWorld.class


The following code is generated by ClassFileAnalyzer from the class file HelloWorld.class:

; HelloWorld.j

; Generated by ClassFileAnalyzer (Can)
; Analyzer and Disassembler for Java class files
; (Jasmin syntax 2,
; ClassFileAnalyzer, version 0.7.0 

.bytecode 50.0
.class public HelloWorld
.super java/lang/Object

.method public <init>()V
  .limit stack 1
  .limit locals 1
  .line 3
  0: aload_0
  1: invokespecial java/lang/Object/<init>()V
  4: return
.end method

.method public static main([Ljava/lang/String;)V
  .limit stack 2
  .limit locals 1
  .line 6
  0: getstatic java/lang/System/out Ljava/io/PrintStream;
  3: ldc "Hello World!"
  5: invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
  .line 7
  8: return
.end method





JAR file classfileanalyzer.jar only:
Source code of ClassFileAnalyzer:
ClassFileAnalyzer as NetBeans project:






java -jar classfileanalyzer.jar [options] [<jarfile>] <classfile>

java ClassFileAnalyzer [options] [<jarfile>] <classfile>
java Can [options] [<jarfile>] <classfile>

  Java class file to be disassembled.

  Java Archive (JAR) file, which includes the Java class file to be
  disassembled (optional).

    Print version information.
    Generate file in actual directory with assembler source text.
    Print additional informations, e.g. hexdump of classfile.
    Omit pc label before mnemonic.
  -help, -?
    Print usage message.



Download and install Java SE: Java SE Downloads

  • Execute ClassFileAnalyzer encapsulated in the JAR file classfileanalyzer.jar:

        java -jar classfileanalyzer.jar HelloWorld.class
  • If classfileanalyzer.jar is already in the classpath:

        java ClassFileAnalyzer HelloWorld.class

    Examples for using the classpath (modify path to JAR file classfileanalyzer.jar):

        java -classpath classfileanalyzer.jar ClassFileAnalyzer HelloWorld.class
        set CLASSPATH=classfileanalyzer.jar
        java ClassFileAnalyzer HelloWorld.class

    (The setting of the CLASSPATH environment variable depends on your operating system. Windows: It can be set using the System utility in the Control Panel.)

  • Copy classfileanalyzer.jar in the directory (optional package, extension mechanism):

        lib/ext    [in the JRE]

    Classes within JAR files in this directory can then be used by applications, without having to explicitly include them in the classpath:

        java ClassFileAnalyzer HellowWorld.class

Example: Disassemble classfileanalyzer/ClassFile.class

java ClassFileAnalyzer c:/classfileanalyzer.jar classfileanalyzer/ClassFile.class





Option -info: TestCanOptionInfo


.annotation default directive: TestCanAnnotationDefault, TestCanAnnotationDefault2, TestCanAnnotationDefault3

.annotation invisible directive: TestCanRuntimeInvisibleAnnotations, TestCanRuntimeInvisibleAnnotations2

.annotation invisibleparam directive: TestCanRuntimeVisibleParameterAnnotations

.annotation visible directive: TestCanRuntimeVisibleAnnotations, TestCanRuntimeVisibleAnnotations2, TestCanRuntimeVisibleAnnotations3, TestCanRuntimeVisibleAnnotations4

.annotation visibleparam directive: TestCanRuntimeVisibleParameterAnnotations

.debug directive: TestCanDebug

.deprecated directive: TestCanDeprecated

.enclosing method directive: TestCanInner2

.field directive: TestCanField

.inner directive: TestCanInner, TestCanInner2, TestCanInner3

.interface directive: TestCanInterface

.signature directive: TestCanSignature

.stack directive: TestCanStack, TestCanStack2

.var directive: TestCanVar


JVM instructions: TestCanWide, TestCanLookupswitch, TestCanTableswitch




Mapping: Attributes - Directives

  Attribute Directive
1. ConstantValue (.field)
2. Code (.limit stack, .limit locals, .catch)
3. StackMapTable .stack
4. Exceptions .throws
5. InnerClasses .inner class, .inner interface
6. EnclosingMethod .enclosing method
7. Synthetic *  
8. Signature .signature
9. SourceFile .source
10. SourceDebugExtension .debug
11. LineNumberTable .line
12. LocalVariableTable .var
13. LocalVariableTypeTable .var
14. Deprecated .deprecated
15. RuntimeVisibleAnnotations .annotation visible
16. RuntimeInvisibleAnnotations .annotation invisible
17. RuntimeVisibleParamterAnnotations .annotation visibleparam
18. RuntimeInvisibleParameterAnnotations .annotation invisibleparam
19. AnnotationDefault .annotation default

* A class, field or method that does not appear in the source code (it was generated by the compiler/assembler) must be marked using a Synthetic attribute, or else it must have its ACC_SYNTHETIC bit set. The only exceptions to this requirement are for default constructors and the class initialization method. The Synthetic attribute was originally introduced in JDK 1.1 to support nested classes (nested interfaces). Example: .field private static final synthetic $VALUES ... (TestCanRuntimeInvisibleAnnotations2)




Class file format: Attributes

Attributes are used in the following structures of the class file format: ClassFile, field_info, method_info and Code_attribute.

  ClassFile field_info method_info Code_attribute
ConstantValue   X    
Code     X  
StackMapTable       X
Exceptions     X  
InnerClasses X      
EnclosingMethod X      
Synthetic X X X  
Signature X X X  
SourceFile X      
SourceDebugExtension X      
LineNumberTable       X
LocalVariableTable       X
LocalVariableTypeTable       X
Deprecated X X X  
RuntimeVisibleAnnotations X X X  
RuntimeInvisibleAnnotations X X X  
RuntimeVisibleParameterAnnotations     X  
RuntimeInvisibleParameterAnnotations     X  
AnnotationDefault     X  




Frequently Asked Questions (FAQ)

Is Can an abbreviation?
Can is an abbreviation for ClassFileAnalyzer.





ClassFileAnalyzer 0.7.0 released - 19. February 2008
     New name: ClassFileAnalyzer (Can).
     Line terminator: \n replaced by System.getProperty("line.separator")
     Source code slightly changed.

Clara 0.6.3 beta released - 01. November 2007
     Source code slightly changed.
     Clara 0.6.2 beta. Bug fix: attributes field_info (only one attribute recognized).
     Clara 0.6.1 beta. Bug fix: JVM instruction lookupswitch (labels).

Clara 0.6.0 beta released - 03. September 2007
     First public version of Clara disassembler.











Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. is independent of Sun Microsystems, Inc.

This site uses Google services (DE: Diese Seite nutzt Google-Dienste - siehe dazu Datenschutz).

created-with-nb-1-mod.gif       made-with-jedit-9-mod.png


@Author Harald Roeder