Appendix H About the CD-ROM
This CD-ROM contains Java development tools I find intriguing. What drives my choices is that they all work at a very low level. This isnt just another collection of applets and publishers editions. Instead, the CD-ROM is full of hardcore hacking tools for Java. As such, some of these tools are a little rough-edged, so exercise a bit of caution when using them.
Nonetheless, Ive found these tools to be useful and thought-provoking. When you put them all together, youve got both the foundation of an almost complete Java environment (runtime, compilers, and so on) and a complete package for reverse engineering Java files (decompiler, disassembler, class browser, and so on). Many of these tools are GPLd (published under the Free Software Foundations General Public License) and thus, in many cases, source code is included. Even if you dont replace your Sun-supplied compilers and runtimes with these versions, you can still learn a lot about Java by studying the source code for these programs.
The one piece I was not able to include on the CD-ROM that I really, really wanted was an independent implementation of the AWT with source code. However, I do suggest that you check out http://www.biss-net/bis-awt.html to learn about the BISS AWT package. While youre at it, you should also learn about the Jolt project (http://www.redhat.com/linux-info/jolt/) thats attempting to produce a freely redistributable, clean-room clone of Java using many of the pieces on this very CD-ROM.
I also hoped to include the complete source code for Suns Java here, as well. However, the standard JDK does include the source code for at least the java packages. Unzip the src.zip file in the main JDK directory.
What Is Included on the CD-ROM
The tools you will find on this disc include the following:
- ! David Engbergs guavac compiler
- ! Tim Wilkinsons Kaffe virtual machine and JIT
- ! Robert Rauds ClassViewer class browser
- ! Aart Biks JAVAR thread optimizer
- ! Wingsofts Wingdis decompiler
- ! PFP Software GmbHs DeJAVA disassembler
- ! KB Srirams Hashjava obfuscator, Jas byte code assembler, and Jinstall installer maker
Ive also included Per Bothners Kawa Scheme compiler that outputs Java byte code and Colin J. Taylors Java Lambda Calculus Interpreter, which is written entirely in Java.
These tools are included on the disk uncompressed, unarchived form. Where you find a zip file, it is an uncompressed zip file that stores a Java package or packages that you should place in your class path. In all cases you should mount the CD in the usual fashion for you operating system, and then copy the directories youre interested in onto your hard drive. These directories are:
- CLASSVIEWER
- DEJAVA
- GUAVAC
- JAS
- JAVAR
- JINSTAFF
- KAFFE
- KAWA
- LAMBDA
There are also a SOURCE directory which contains source code from this book and a README file which is essentially this appendix. Information about the specific packages follows.
A Word About the Programs
Guavac is a Java compiler written in C++ by Effective Edge Technologies and distributed under the Gnu General Public License. You should feel free to use, copy, and modify it, based on the terms in the COPYING file included in this distribution. Guavac is distributed free of charge in the hopes that other people will find it useful and possibly enhance its utility in turn.
Guavac should produce correct byte code for valid Java input, but you may encounter some difficulties in compiling Guavac itself, which may make Guavac impractical for inexperienced programmers. Guavac is written in C++, so it requires a decent C++ compiler and a class library that implements the standard C++ libraries defined in the current C++ standard. To be more specific, Guavac uses a few STL collection classes (like map and deque) as well as the standard string class, which is used for Javas 16-bit (Unicode) strings. This has only been tested using gcc (Version 2.7.2) and libg++ (Version 2.7.1), which seem to work out of the box on Linux, OSF, Irix, and Solaris. Older versions of gcc will not work. The C++ code you use should be reasonably portable to an alternate C++ compiler that also supports the standard templates. The only blatantly non-portable code that may require changing is in dynamic_cast.h. Read the comments there for more information.
Tim Wilkinsons Kaffe 0.83 is a virtual machine design for most Unix-like systems. Kaffe performs just-in-time compilation. If full JIT support isnt possible, the system defaults to an interpreter. The Kaffe home page is at http://www.kaffe.org.
Robert Rauds ClassViewer displays the methods and fields defined in a Java .class file. You can browse into other classes referred to in the .class file and decompile the class file if you also have Mocha installed. This is useful when source code is not available and as a verification and troubleshooting tool. Files can be locally stored or downloaded from a Web site. The Java ClassViewer is written in Java and works on any platform where Java is supported. The ClassViewer home page is at http://www.intac.com/~robraud/classinfo.html.
Aart Biks JAVAR, Version 1.2 beta, is a prototype restructuring compiler that can be used to make implicit parallelism in Java programs explicit by means of multi-threading. This prototype tool does not provide a complete Java front-end (for instance, unicode escapes are not supported and only limited semantic analysis has been implemented). Therefore, applying JAVAR to a program should be postponed until after a program has been thoroughly tested using a full Java compiler. Moreover, JAVAR relies completely on the identification of implicit parallelism by means of annotations. However, the tool provides sufficient functionality to make the parallelization less complex and less error-prone. The JAVAR Web page can be found at http://www.extreme.indiana.edu/hpjava/.
WingDis 2.0.3 is a command-line decompiler that allows users to convert a Java class or Java byte code file to a Java-like program. The eventual goal of WingDis is to generate an equivalent and compilable Java source code (text) from a Java class file (binary). The Wingsoft home page is at http://www.wingsoft.com/.
PFP Software GmbHs DeJAVA, Version 1.13, is a Windows 95/NT console mode application that disassembles .class byte code files, much like the javap utility that ships with Suns JDK.
Colin J. Taylors Java Lambda Calculus Interpreter 1.00 is a GPLd lambda calculus interpreter that uses call-by-name semantics written in Java. The language is mostly Churchs simple untyped lambda calculus; the only concession for usefulness is the addition of numbers. (If this sounds like Greek to you, and you dont speak Greek, dont worry; but theoretical computer scientists really do get quite jazzed about this sort of thing.) The Java Lambda Calculus Interpreter home page is at http://www.cs.nott.ac.uk/~cjt/eval/Lambda.html.
Per Bothners Kawa Scheme compiler, Version 1.4, compiles R4RS Scheme source code into Java byte code. It provides Scheme access to Java objects, fields, and methods. The gnu.bytecode package is used to generate and manipulate .class files. The Kawa home page is at http://www.cygnus.com/~bothner/kawa.html.
KB Srirams Jinstall 0.1 is an application that packs a directory into a single class file, which can then be run as an application to unpack itself on another machine. In fact, Jinstall itself is distributed as a Jinstall class. To unpack it, copy the install.class file to your hard drive and run java install from the command line. The JInstall home page is at http://www.sbktech.org/jinstall.html.
KB Srirams Hashjava 0.3 is a java package which obfuscates symbols in your bytecode, making it a little harder to decompile. The Hashjava home page is at http://www.sbktech.org/hashjava.html. Hashjava is distributed as a jinstall class. To install it copy the hjinstall.class file onto your hard drive, and run java hjinstall.
KB Srirams Jas 0.4 is a java package to generate java bytecode. It includes a scheme like scripting language to drive the package and generate bytecode. The Jas home page is at http://www.sbktech.org/jas.html.
Finally, all the source code for the examples in this book is included. Please feel free to reuse any or all of this source code in your own projects. No specific permission is necessary or required.
|