executablebytecodeelfmachine-code.class-file

What is the difference in byte code like Java bytecode and files and machine code executables like ELF?


What are the differences between the byte code binary executables such as Java class files, Parrot bytecode files or CLR files and machine code executables such as ELF, Mach-O and PE.

what are the distinctive differences between the two?

such as the .text area in the ELF structure is equal to what part of the class file?

or they all have headers but the ELF and PE headers contain Architecture but the Class file does not

Java Class File Java Class file

Elf file ELF File

PE File PE File


Solution

  • Byte code is, as imulsion noted, an intermediate step, right before compilation into machine code. Because the last step is left to load time (and often runtime, as is the case with Just-In-Time (JIT) compilation, byte code is architecture independent: The runtime (CLR for .net or JVM for Java) is responsible for mapping the byte code opcodes to their underlying machine code representation.

    By comparison, native code (Windows: PE, PE32+, OS X/iOS: Mach-O, Linux/Android/etc: ELF) is compiled code, suited for a particular architecture (Android/iOS: ARM, most else: Intel 32-bit (i386) or 64-bit). These are all very similar, but still require sections (or, in Mach-O parlance "Load Commands") to set up the memory structure of the executable as it becomes a process (Old DOS supported the ".com" format which was a raw memory image). In all the above, you can say , roughly, the following:

    Hope this helps. Really, your question was vague..

    TG