Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Assembly and Dissassembly are reflexive operations.  You can feed one tool into another to achieve the same file.  For example

java -jar asmtools.jar jdec foo.class > foo.jcod   # produces foo.jcod
java -jar asmtools.jar jcod foo.jcod jcod                      # produces foo.class

For a given class foo.class, the product of dissassembly, and re-assembly is the same foo.class.

...

$ java -jar asmtools.jar jasm [options] filename.jasm

or

$ java -cp asmtools.jar com.sun.asmtools.jasm.Main [options] filename.jasm

Options:

optiondescription
-version           Print jasm tool version
-d destdirSpecifies a directory to place resulting .class files. If a destdir is not provided, the .class file will be written in the current directory.
-gAdd debug information to .class file

...

-nowriteDo not write resulting .class files. This option may be used to verify the integrity of your source jasm file

...

-strictConsider warnings as errors.
-nowarnDo not print warnings.
-cv major.minorSet the operating class file version (by default 45.3).

Note - If the optional class attribute 'version' defines (in source of class) the class file version, then it overrides default class file version set by -cv option.

...

To use jasm, specify the filename of the .jasm file you wish to develop a .class file from. The Jasm Specification contains information relative to the format of a

Refer to Appendix A (Jasm Syntax) documentation for information on the structure of the .jasm file.

 

...

Jdis

jdis is a disassembler that accepts a .class file, and prints the plain-text translation of jasm source file to the standard output.

...

$ java -jar asmtools.jar jdis [options] filename.class

or

$ java -cp asmtools.jar com.sun.asmtools.jdis.Main [options] filename.class

Options:

optiondescription
-version           Print jdis tool version

...

-gGenerate a detailed output format. Constants from constant pool are printed, and instructions in methods are preceded with source line numbers (if attribute LineNumberTable is available) and with bytecode program counters.
-s1Generate source lines in comments. Commented lines of the source file, from which given .class file is obtained, are printed above the corresponding instruction. Both attributes LineNumberTable and SourceFile must be available. The source file should be placed in the current working directory.
-hxGenerate floating-point constants in hexadecimal format.

Description:

To use jdis, specify a filename.class that you wish to disassemble.
You may redirect standard output to a filename .jasm file. Jdis will disassemble a .class file and create a resultant .jasm source file.

Refer to the Jasm Assembler to Appendix A (Jasm Syntax) documentation for information on the structure of the resultant .jasm file.

 

...

Jcoder

jcoder is a low-level assembler that accepts text based on the Jcoder Jcod Specification. and produces a .class file for use with a Java Virtual Machine. Jcod's primary use is as a tool for producing specialized tests for testing a JVM implementation.

Usage:

$ java -jar asmtools.jar jcod jcoder [options] filename.jcod

or

$ java -cp asmtools.jar com.sun.asmtools.jcodjcoder.Main [options] filename.jcod

Options:

optiondescription
-version           Print

...

jcoder tool version
-d destdirSpecifies a directory to place resulting .class files. If a destdir is not provided, the .class file will be written in the current directory.
-nowriteDo not write resulting .class files. This option may be used to verify the integrity of your source jcod file.

Description:

To use jcod, specify the filename.jcod file you wish to develop a .classfile from. The Jcod Specification contains information relative to the format of a

Refer to Appendix B (Jcod Syntax) documentation for information on the structure of the  .jcod file.

 

...

Jdec

jdec is a low-level disassembler that accepts .class file and prints a plain text of jcod source file to the standard output.

...

$ java -jar asmtools.jar jdec [options] filename.class [> filename.jcod]

or

$ java -cp asmtools.jar com.sun.asmtools.jdec.Main [options] filename.class [> filename.jcod]

Options:

optiondescription
-version           Print jdec tool version

...

-gGenerate a detailed output format.

Description:

To use jdec, specify a filename.class that you wish to disassemble.
You may redirect standard output to a filename.jcod file. jdec will disassemble .class file and create a resultant .jcod plain source file.

Refer to the Jcod Low-Level Assembler to Appendix B (Jcod Syntax) documentation for information on the structure of the resultant .jcod file.

...

$ java -jar asmtools.jar jcdec [options] filename.exp | filename.cap [> filename.jcod]

or

$ java -cp asmtools.jar com.sun.asmtools.jcdec.Main [options] filename.exp | filename.cap [> filename.jcod]

Options:

optiondescription
-version           Print jcdec tool version

...

-gGenerate a detailed output format.

Description:

To use jcdec, specify a filename.exp or filename.cap that you wish to disassemble.
You may redirect standard output to a filename.jcod file. jcdec will disassemble the file and create a resultant .jcod plain source file.

Refer to the Jcod Low-Level Assembler to Appendix B (Jcod Syntax) documentation for information on the structure of the resultant .jcod file.

...