Skip to content

How does the compilation process work?

Compilation

The process of creating (implementation) and launching Java applications can be divided into several phases:

  • Implementation - creating the source code of the application, i.e. typing down the computer program with the use of a specific programming language, describing the operations that the computer should perform on the data that is collected or received. The source code is the result of the programmer's work and allows to express in a human-readable form the structure and operation of the computer program.

  • Compilation - our program written in Java language is run by a special tool called compiler on the so-called virtual Java machine (JVM). The compiler converts source code into machine code understood by JVM, so called JVM. bytecode. Besides that, the compiler is supposed to find lexical and semantic errors and optimize the code.

  • Interpretation - this is the process of machine code analysis and its execution. These actions are performed by a special program called the interpreter.

The whole process is illustrated in the diagram below:

java compilation

Installation of the Java Launcher

As programmers, we will write our Java code in .java files, and the compiler will translate it into bytecode and put it in .class files. The entire JVM environment and development tools can be downloaded and installed as JDK (Java Develpment Kit). The JDK package includes both a bootable environment (JRE - Java Runtime Environment) and additional tools for developers, such as a compiler (javac - Java compiler).

The OpenJDK installation description can be found here