Why you should use the Eclipse compiler in Intellij IDEA

If you use Intellij, you should consider using the Eclipse compiler instead of Javac.

The compiler used for your project can be changed in the IDE settings page.

Note that if you are using Java 8, then only Intellij 14 and higher have options to select the Eclipse compiler.

Unlike Javac, the Eclipse compiler is designed to be used first and foremost inside an IDE and thus offers some features that make it ideal for development usage:

1. Proceed on errors

It is entirely possible that some portion of your source code may contain some compile time errors, however you want to quickly try executing some small test to check if some other part of your code works properly or not.

With the Javac compiler, you won’t have a choice but to fix all those errors before you are allowed to execute anything. The Eclipse compiler however will allow you to execute code regardless. Its aim is to always produce a runnable binary. If your code does hit a line with compile time error in it, it will throw a runtime exception instead.

To enable this feature, you will need to:

  1. Check ’Proceed on errors’ in the Compiler settings page.

  2. Replace the ’Make’ build step of your Run Configuration with ’Make, no error check’.

2. Incremental Compilation

The Eclipse compiler is designed to run in the background of an IDE and thus natively supports incremental compilation. What this means is that it can compile only the changed blocks of code since the last compile, resulting in very fast build times.

3. Parallel compilation

Unlike Javac, the Eclipse compiler can use multiple cores to speed up compilation, finally putting all those extra cores in your PC to good use.

Conclusion

As can be seen, there is no good reason to continue using Javac inside an IDE. Hopefully Jetbrains will make it the default compiler in future versions of Intellij IDEA.

Show Comments