Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the java compiler assemble?

So gcc or any C compiler will compile your source to x86 or your respective Assembly language then assemble the assembly into binary and then link it to create an executable. My question is does the java compiler contain an assembler? Meaning is there an intermediate stop because I understand bytecode isn't machine code but it is stored as binary and isn't plain text either. I'm assuming it's just the text based bytecode stored in binary format but I really don't know.

like image 972
Scoopta Avatar asked Dec 19 '22 06:12

Scoopta


1 Answers

Like you said, the Java Compiler generates bytecode. This bytecode then goes into the Java Virtual Machine which magically "makes the code happen". Since the JVM is a specification which has multiple implementation this magical part can be Just In Time compilation or simply interpreting. Related question here.

So to answer your question, no, the java compiler does not contain an assembler. The JVM may contain one but isn't forced to because that's implementation detail.

like image 124
Ruben Avatar answered Jan 04 '23 07:01

Ruben