Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java bytecode specification [closed]

Tags:

java

jvm

bytecode

People also ask

Is Java bytecode human-readable?

The important point is, the M in JVM stands for machine, therefore, it's straight-forward to design the bytecode to be machine readable, instead of human readable. It's not clear why the OP thinks, a human readable bytecode helped a software like the JVM to process it.

Is Java bytecode the same on all computers?

Of course, a different Java bytecode interpreter is needed for each type of computer, but once a computer has a Java bytecode interpreter, it can run any Java bytecode program. And the same Java bytecode program can be run on any computer that has such an interpreter.

What is the size of bytecode in Java?

Each can be independently sized from 0 to 65535 values, where each value is 32 bits.

Can I run a Java bytecode on any platform?

d) It can run on any platform that has a Java compiler. e) It can run on any platform only if that platform has both Java Runtime Environment and Java compiler. I think (c) is the correct answer, assuming that the Java Runtime Environment is the interpreter.


A good reference for Java bytecode specification is the The Java Virtual Machine Specification.

See Chapter 4. The class File Format and Chapter 6. The Java Virtual Machine Instruction Set.


A little more "graphic" explanation, IBM developer works: Understanding bytecode makes you a better programmer.


Also useful are the javap disassembler and bytecode manipulation frameworks like ASM and BCEL, even if all you want to do is verify your classes.


The book Programming for the Java Virtual Machine explains the JVM instruction set and how to write code for it. It also introduces a bytecode assembler called Oolong, which I have not been able to download. You can, however, use Jasmin, the predecessor of Oolong. Essentially, you write a text file with instructions and Jasmin will spit out a .class file. The book was published in 1999, but it is still a good and gentle introduction to the VM.


The Java Virtual Machine Specification is a good place to start.

See Chapter 4 The class File Format. The updates cover new attributes added since the 2nd edition was made.