The javac compiler is slow and expensive - I need a way to optimize for my application.

Nathan Meyers

The javac compiler doesn't have any such daemon mode, but here are a couple of suggestions:

  • Use the Jikes compiler from IBM. It's open source, written in C++, very portable, and very fast. Building with Jikes instead of javac will solve the performance problem.
  • It might work to write your own long-lived daemon in Java and call javac's main entry point. But it also might not work - there might be some statics that aren't properly initialized if you reuse the compiler in a running JVM.