Can I compile Java to native code? Can I compile Java to native code? java java

Can I compile Java to native code?


There used to be a tool called GCJ that was part of GCC, but it's been removed. Now, all the links in the GCC site re-direct to their non-GCJ equivalents.

NB: the comments all refered to my original answer saying you can compile Java to native code with GCJ.


Yes!

Oracle has been working on the GraalVm, which supports Native Images. Check here: https://www.graalvm.org/

Native Image The native image feature with the GraalVM SDK helps improve the startup time of Java applications and gives them a smaller footprint. Effectively, it's converting bytecode that runs on the JVM (on any platform) to native code for a specific OS/platform — which is where the performance comes from. It's using aggressive ahead-of-time (AOT) optimizations to achieve good performance.

See more:


Excelsior JET is a commercial Java to native code compiler. However, it was discontinued in May 2019.