Search code examples
javacompiler-constructioncommand-line-interface

Are there any commands to get the intermediate files of Compilation for Java Code?


Similar to C or C++ where you can get the intermediate files are there any commands to get same for Java Code?

For example, C file can generate,

Preprocessed File (Hello.i)
Compilation file (Hello.s)
Assembly File (Hello.o)
Executable File through Linker (Hello.exe)

In java we do,

Executing --> Filename.java
we obtain --> Filename.class

and then we run this class file for output.

Is there a way to generate Preprocessed, compiled and assembly files for Java code?


Solution

  • No. The Java compiler generates bytecode (contained in .class), there are no intermediary steps.

    The JIT compiler(s) then generate assembly and machine code, and those can be seen with suitable flags given while running the program.