Assembler and Disassembler
Frequently Asked Questions


Q. Can the assembler generate invalid class files?

Yes. Any class file generated by the assembler is not guaranteed to satisfy the constraints given in the Java(TM) Virtual Machine Spec.

Q. Does the assembler do CLASSPATH lookup to verify references across classes?

No. The assembler does not check references to other classes and in general will not perform checks that are required of a java compiler.

Q. If the first line of a jasm source file is: package foo/bar; will the assembler put the class file in the directory ./foo/bar?

No. The assembler creates the class file in the current directory regardless of a package is specified or not.

Q. Is the assembler able to compile any file created by the disassembler & vice versa?

This is generally the case. However, there are exceptions to this rule. For example, the assembler allows an interface to "extend" other interfaces, and will not accept the keyword "implement". However, when the same assembler generated class file is disassembled, the keyword "implements" is used.

Q. How can I insert arbitrary bytes into a method's code?

The assembler provides a special mnemonic "bytecode" which allows you to do this. For example, in order to insert bytes 0x3 and 0x9 into a method the following can be done: ... bytecode 0x3, 0x9; ...

Q. What options are supported by the assembler/disassembler?

The following flags can be specified:

Assembler:
Usage: jasm [options] file.jasm...
where options are:
-gadd debug information
-nowritedo not write resulting .class files
-d destdirdirectory to place resulting .class files
-mayarecognize new opcodes for picoJava-II(TM)

Disassembler:
Usage: jdis [options] FILE.java | FILE.class... > FILE.jasm
where options are:
-gdetailed output format
-slsource lines in comments
-mayarecognize new opcodes for picoJava-II(TM)

Copyright © 1999 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303-4900 USA. All rights reserved.


Last modified 24-March-1999