javaeclipsejavacsunincremental-compiler

Can standard Sun javac do incremental compiling?


Recently I started to use Eclipse's java compiler, because it is significantly faster than standard javac. I was told that it's faster because it performs incremental compiling. But I'm still a bit unsure about this since I can't find any authoritative documentation about both - eclispse's and sun's - compilers "incremental feature". Is it true that Sun's compiler always compiles every source file and Eclipse's compiler compile only changed files and those that are affected by such a change?

Edit: I'm not using Eclipse autobuild feature but instead I'm setting

-Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter

for my ant builds.


Solution

  • Is it true that Sun's compiler always compiles every source file and Eclipse's compiler compile only changed files and those that are affected by such a change?

    I believe that you are correct on both counts.

    You can of course force Eclipse to recompile everything.

    But the other part of the equation is that Java build tools like Ant and Maven are capable of only compiling classes that have changed, and their tree of dependent classes.

    EDIT

    In Ant, incremental compilation can be done in two ways: