Difference Between Ordinary
Compilation and Java Compilation
Ordinary Compilation (Rephrased)
1. 1. A typical compiler converts code written in a high-level language into a lower-level
language like machine code or assembly.
2. 2. This process generates an executable file that can run directly on the target computer
system.
3. 3. Once compiled, the program doesn’t need any additional software to run — it
executes directly.
4. 4. The compiled file is usually designed for a specific operating system and hardware,
making it non-portable across different platforms.
5. 5. Many compilers include optimization techniques to improve the speed and efficiency
of the final program.
6. 6. Programming languages like C and C++ are commonly compiled using this method to
produce machine-specific executables.
7. 7. The whole source code must be compiled before the program can be executed,
creating a complete executable file.
8. 8. Compilation stops if there are any errors in the code; the program must be error-free
to run.
9. 9. Sharing these programs means providing the final executable, which only works on
compatible systems.
10. 10. Since the code is already in machine language, it runs faster at runtime compared to
interpreted languages.
Java Compilation (Rephrased)
11. 1. Java uses a dedicated compiler to translate Java source code into another format for
execution.
12. 2. Instead of creating machine code, it produces bytecode stored in `.class` files, which
serve as a universal format.
13. 3. This bytecode is then run by the Java Virtual Machine (JVM), which either interprets it
or compiles it at runtime.
14. 4. Bytecode enables Java programs to be run on different platforms without needing to
change the source code.
15. 5. Java uses Just-In-Time (JIT) compilation to convert bytecode into native machine code
while the program is running.
16. 6. The main compiler for Java is called `javac`, and it comes with the official Java
Development Kit (JDK).
17. 7. Developers can also use a standard Java API (JSR 199) to interact with compilers
programmatically.
18. 8. The Java Runtime Environment (JRE) combines the JVM and other components to
execute bytecode dynamically.
19. 9. Like traditional compilers, the Java compiler checks the code for errors and only
produces bytecode if no issues are found.
20. 10. Java programs are shared as bytecode files, which can run on any device with a
compatible JVM, making distribution easier.