The Java Virtual Machine only knows Java bytecode.
A JVM doesn't care what program produced the byte code. The byte
code could come from the Sun javac
compiler but there are other compilers that produce standard bytecode
as well.
There are a number of possible motivations for using
an independently written compiler:
- There may not be a Sun compiler available for a particular platform.
- javac
is written in Java and may run slower than a compiler written
in C/C++.
- The alternative compiler may have optimization capabilities
superior to Sun's compiler, at least for the JVM and the platform
that you plan to use.
- The compiler might have particular features that you like, such
as producing clear and informative error messages.
- The compiler could be part of a popular IDE.
- Native code compilers convert the source code directly to the
machine code for a particular platform. This provides high performance
for that machine, but, of course, it eliminates the transportability
aspect of Java programs and dynamic binding of new classes.
Here is a list of some Java compilers:
- javac
- Sun's compiler is written in Java itself. Available for a wide
range of platforms. Comes with the freeware JDK package of programs.
Available at java.sun.com.
- Jikes
- open source freeware compiler. It strictly follows the Java
Language and the JVM specifications. It is written in C++ and
runs fast and so is useful for large code projects. It also "
performs a dependency analysis on your code that provides two
very useful features: incremental builds and makefile generation."
More information and downloads available at IBM
Developerworks.
- Kopi
- "a Java software project from DMS, providing a development
environment for database applications using Java, JDBC and JFC/Swing."
Available at the Kopi
Project.
- Lists of other compilers
can be found at:
Note that the bytecode, in fact, could come form a non-Java source
code. That is, the source code might be in C++ source code and a
C++ to Java compiler will produce byte code that executes
in a standard JVM.
See Programming
Languages for the Java Virtual Machine - Robert Tolksdorf for
information about generating Java bytecode from languages other
than Java.
Latest update: Dec.10.2003
|