Bytecode, Java, and you
DEADBEEF, CAFEBABE...
Animation
source code
javac
*.classJVM
machine code
CPU
In short
- You first write source code, which is human-readable code.
- You use a compiler (
javac) to turn the source code into Java bytecode. - A process virtual machine (JVM) executes machine code.
HotSpot
OpenJDK's JVM, HotSpot, is neat because it detects "hot spots" of the bytecode and compiles these sections into machine code, speeding up execution.
CAFEBABE
The bytes 0xCAFEBABE is the magic number denoting the start of every bytecode class file.
What languages do this?
- Java
- Python (
pycfiles)