Is there any posibility to cache java compilation like ccache does for C or C++ compilation?
I have a lot code to compile, and I compile the same code many times, so it took a lot of time. So I thought to cached it to speed up.
Is there any posibility to cache java compilation like ccache does for C or C++ compilation?
I have a lot code to compile, and I compile the same code many times, so it took a lot of time. So I thought to cached it to speed up.
Eclipse does incremental compile of classes (I guess others do this as well). Only the portion of your class that changes will be compiled. Everything else will not be changed. It works reasonably well in real world projects.
Build tools like Maven and Ant can be configured to compile only changed java files. These do not track dependencies in some scenarios they miss needed compiles. (For example change the signature in a super class.)
The best way would be to factor the shared classes into utility jars that you would simply include in your compile classpath, unless there is really a specific (and good) reason that prevents you from doing so (code duplication is evil and will lead you to doom :)).
There's no caching functionality in Sun's JDK itself, as far as I am aware.
Most Java IDEs however will cache compilation, so if you need "compilation on demand", that should do.
Eclipse and Netbeans definitely have this. They will only recompile changed classes (and their dependencies, which they figure out automatically). This is fairly fast for most changes.
But the main problem is that, the whole source code has many files in many directories, and there are so many java files. Compilation is done by the ant scripts which are invoked by the make script. It has to be compiled by the Sun's JDK. And what is more... between compilations I have to clean all created *class files.
So I cannot use any of IDE's features.