In computing, a Java compiler is a computer program that translates programs in the Java programming language source code to Java class files.
As of 2006, the following are major Java compilers:
- javac, included in JDK from Sun Microsystems, open-sourced since the 13 November 2006.
- GCJ, a part of gcc which compiles C, Fortran, Pascal and other programming languages besides Java. It can also generate native code using the back-end of gcc.
- ECJ, the Eclipse Compiler for Java, is an open source incremental compiler used by the Eclipse JDT.
- Jikes, an open source compiler from IBM, which is written in C++ and uses a variant of static single assignment form for optimization. As of early 2006 the project is no longer being actively developed.[citation needed]
The compiler compiles the Java source code to a Java class file that contains the generated Java bytecode. Even though each compiler uses a different technique, they all generate the same class file format.
Most Java compilers, Jikes being the only exception, do virtually no optimization, leaving this until runtime to be done by the JRE[citation needed].
Using this generated Java bytecode, the Java Virtual Machine (JVM) loads the class files and either interprets the bytecode or just-in-time compiles it to machine code and then possibly optimizes it using dynamic compilation.
The very first Java compiler developed by Sun Microsystems was written in C using some libraries from C++.[citation needed]
External links
- Sun's OpenJDK javac page
- Jikes homepage
- JSR 199 Java Compiler API Java Specification Request for invoking the Java compiler from a Java program
- Java Sun