If you are using the primary compiler, Javac , you will need a JVM.
The JVM does not affect compilation, this is only necessary because the main compiler is actually the Java program itself, and a JVM is required to run Java programs.
Theoretically, a compiler is the only thing you need to compile Java code. In fact, the JVM knows nothing about the Java programming language , only bytecode generated from compilers. JVM allows your computer to run Java programs and does not affect the compilation process.However, the primary Java compiler was written in Java. To start the main compiler you need a JVM.
If you used a compiler written in another language, you do not need a JVM to compile the code.
source
share