You use a static compiler such as Sun’s javac.exe or jikes.exe to create platform-independent, binary, JVM byte code. Then you can either:
| Compiler classifications | ||
|---|---|---|
| Code Letter | Meaning | Advantages and Disadvantages |
| I | Interpreter | Interpreters are easy to write. Thus they appear on any new platform first. They start execution instantly. The code is compact. However, they are usually the slowest to execute. The lines between software interpreter, firmware interpreter and microchip that runs byte codes directly is blurry. The more hardware assist you have, the faster the execution and the smaller the package you can squeeze everything into. With sufficient hardware assist, this is the fastest approach. |
| N | AOT (Ahead Of Time) Static Native code, complied to machine code at the developer site from byte codes. Sometimes called AOT Ahead Of Time compilers. | Native code compilers do all their work long before the execution starts. They take a long time to study the code. They figure out what can be precalculated, what tests were not really necessary, which objects can be safely stack allocated for speed. They inline aggressively. They study the program as whole globally optimising, not just method by method. They unravel in ways no assembler programmer would have the patience for. The result is a standard platform-dependent executable. These now rival C++ in speed and are getting better daily. The catch is you need to buy a different compiler for every native platform. And you have to distribute a different executable for every platform, and sometimes a fat runtime library as well. Happily, you can use these tools even when you don’t have the source. They work with the class or jar files as input. This means you as customer can use them to speed up programs you buy. The author of the program need not ever know you used them. Their main weakness is dealing with any sort of on-the-fly newly created or imported classes that were not present at compile time. Either such classes have to be disallowed or not optimised. The other main disadvantage is high cost. Native code, especially highly optimised native code, is considerably more difficult to reverse engineer than Java byte codes, even obfuscated ones. So you might consider using a native compiler for protecting the secrets of your source code. |
| J | JIT compiles every time needed at the client site. | Good for executing platform-independent byte codes freshly downloaded off the web, e.g. an Applet. Does a rough and ready quick compilation and gets on with execution quickly. The code is not particularly fast to execute though. |
| H | Hotspot (starts off interpreting and gradually compiles the hotspots). | This is good primarily for servlets. The disadvantage is the several minutes the servlet womb takes to warm up. The advantage is the system responds to real life bottlenecks, not to theoretical ones. The optimiser has more information about how the code is actually used than on that did all its work before execution started. It can deal with code changing on the fly or being generated on the fly as in JSP. Static native code optimisers cannot. For example it can presume all non-overridden methods are final and do inlining, then change its mind later and undo that if a dynamic class load overrides one of those methods. It leaves rarely used code in compact byte code form. |
| W | Wrapper | This technique looks superficially like native code, but what actually is happening is the class files are bundled with a little kickoff program. The actually running may be by interpretation or by a JIT. Microsoft’s Jexegen was the originator of this technique. |
| Real World Compilers | |||
|---|---|---|---|
| Vendor | Compiler Name | How Run | Notes |
| IBM | AS400 | N | 128 bit address space. |
| IBM | Eclipse | I | Incremental compiler keeps compiling as you edit. Windows, others? |
| JSmooth | JSmooth | W | Wraps Jar in a standard windows executable. |
| IBM | Java 2 | ? | 64 bit, Itanium under Linux |
| IBM | Java 2 | ? | 64 bit, Itanium under Linux |
| NaturalBridge | BulletTrain | N | defunct |
| webGAIN | Café | JW | IDE that comes in Pro and database editions. Includes source code level debugger that lets you evaluate arbitrary expressions that can include method calls. Formerly by Symantec, now called webGAIN Studio. Defunct. |
| Metroworks | CodeWarrior | N | Runs on Linux, Macintosh, Solaris, Windows 95/98/NT. |
| Wind River Systems | Diab FastJ | N | For embedded Systems. |
| Microsoft | J++ | IW | Works with Microsoft’s variant of the Java language that does not have RMI, JNI etc, and has some extra keywords. May be useful for writing Windows-only applications. |
| Sun JavaSoft | javac | I or J or H | Comes with various JDKs. |
| GNU | gcj | I or N | Compiler that accepts either java or class files and emits either class or native object files. |
| Inprise (née Borland) | Jbuilder | J | IDE. See this trick to get Jbuilder to emit a jexegen-style exe file. |
| Excelsior | JET | N | |
| IBM Alphaworks | Jikes | I. Use Sun’s or other’s runtime | very fast compilation, good error messages, works very well with the SmartJ front end. SmartJ is a convenient front end to the compiler and runtime that makes them much smarter and forgiving. |
| Instantiations | Jove | N | highly optimised. Very expensive. Unfortunately, no longer available. |
| KOPI | KJC | I | written in pure Java. GNU opensource. |
| Microsoft | MSIL | ? | Java Language to IL compiler: The Java language converter is the Java equivalent of a C++ language compiler for .NET. It will take Java source files and create the .NET assemblies containing the IL and metadata that can run on the .NET runtime. |
| Manta | Manta | N | GPL for Linux. |
| Dobysoft | NativeJ | W |
standard edition,
professional edition, Not a compiler. Wraps class files to look like a standard windows executable, even a service. |
| Pizza | Pizza | ? | opensource |
| Tower Technology | TowerJ | N | heavy duty optimisation. Generates native code for Solaris, HP/UX, Windows, Linux, Tru64, DG/UX, AIX and SGI, including Itanium. Defunct. |
| Compaq | Tru64 | J | 64 bit. Implementations on AlphaServer and NonStop Himalaya systems, including the JDK v1.2.2 Fast VM for Tru64 UNIX and OpenVMS operating systems. |
| IBM | VAJ, Visual Age for Java | I and N | SCID that offers very good code browsing and source code debugging of multithread apps. Terrible help files. Runs under AIX, OS/2, OS/390, Windows 98 and Windows NT. |
Going the other way from C to Java is also difficult. There is a program C2J that can do an approximate translation of simple C programs to Java. Many of the low-level things you can do in C, such as unions, have no equivalent in Java.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.62] | The information on this page is for non-military use only. | ||
| You are visitor number 23,476. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/jgloss/compiler.html | J:\mindprod\jgloss\compiler.html | ||