How can I generate native code instead of classfiles from my Java source?

Nathan Meyers

The two best-support answers are:

  • The gcj compiler is part of the GNU compiler collection and can be found in any recent distribution of gcc. It builds native applications from Java source or classfiles, although it does not yet fully support the Java 2 platform.

  • The TowerJ product builds native applications with full Java 2 support. It is not inexpensive, and it depends on installation of a licensed TowerJ runtime on the target machine - so it's intended primarily for deployment to high-performance server environments.

There are other commercial solutions, most of which are available for Windows platforms. Some other relevant JGuru answers can be found here and here.