Accepted answer

eclipse has implemented its own compiler called as eclipse compiler for java (ecj).

it is different from the javac, the compiler that is shipped with sun jdk. one notable difference is that the eclipse compiler lets you run code that didn't actually properly compile. if the block of code with the error is never ran, your program will run fine. otherwise, it will throw an exception indicating that you tried to run code that doesn't compile.

another difference is that the eclipse compiler allows for incremental builds from within the eclipse ide, that is, all code is compiled as soon as you finish typing.

the fact that eclipse comes with its own compiler is also apparent because you can write, compile, and run java code in eclipse without even installing the java sdk.

a few examples where ecj is preferred over javac is:


it is a separate compiler altogether. this is needed as javac doesn't allow compilation of slightly broken code, from the eclipse site

an incremental java compiler. implemented as an eclipse builder, it is based on technology evolved from visualage for java compiler. in particular, it allows to run and debug code which still contains unresolved errors.


eclipse's built-in compiler is based on ibm's jikes java compiler. (note that eclipse also started its life at ibm). it is completely independent of sun's java compiler in the jdk; it is not a wrapper around sun's javac.

jikes has existed for a long time, it used to be a lot faster than the standard jdk java compiler (but i don't know if that's still true). as to why ibm wanted to write their own java compiler: maybe because of licensing reasons (they also have their own java implementation).


everyone has already explained that they're different. here are some difference in behaviors i've noticed between the two compilers. they all boil down to a bug in (at least) one of the implementations.

compile-time optimization related

generics type inferrence related

Related Query

More Query from same tag