Native Code Compiler for Java

What Does Native Code Compiler for Java Mean?

Native code compiler for Java (NCCJ) is a compiler application that converts Java code to a native code that can be executed without the need for interpreters. Native code compiler for Java translates the Java code into a binary representation that can be linked to precompiled library files and resources to create an executable program.


Native code compilers eliminate the need for JVM and interpreters to convert the Java byte code, which is a portable intermediate code. By helping convert Java code directly into machine code, native code compilers help in reducing redundancy, reverse engineering and optimizing program execution.

Techopedia Explains Native Code Compiler for Java

Java code is usually converted into an intermediate byte code, which is then compiled into a machine-dependent code with the help of JVM running on each machine where the program is to be executed. This particular feature of Java makes Java programs more flexible and portable across a wide range of devices. But this introduces an overhead and may cause Java programs to take more time than natively compiled code. As the primary design concern for Java as to make it a platform-independent and secure development model, the execution performance lag due to the byte code feature was sidelined.

But when developers want to improve execution performance, they may choose to natively compile the Java classes or certain parts of the code. Native code compilers for Java help to achieve this, and thus help to achieve better processing speed than the byte code interpretation.

The increase in speed may occur due to several factors, such as:

  • Use of numerics
  • Degree of polymorphic message
  • Direct field access
  • Amount of array accessing
  • Casts

The two major types of native code compilers are just-in-time (JIT) compilers and ahead-of-time (AOT) compilers. JIT compilers allow the JVM to translate Java code to machine code as and when needed by the JDK. AOT compilers compile the Java code within a JAR file into native shared libraries before the execution time.

Native compile code is also known as static compilation and provides a consistent performance.


Related Terms

Latest DevOps Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…