Sunday 13 October 2013

What is Java Bytecode?

Bytecode is compiled java code that the Java Virtual Machine executes.

Lets see it with creating source file , compile source file into .class file & run the .class file.

See , you have a helloworld.java file.










now compile it with java compiler javac. This will create a helloworld.class file. By opening this .class file in any text editor will shown as below.


















Now run the code with java ,

java helloworld










The way of Other languages works :
  1. write source code
  2. port source code in different platform
  3. compile source code in platform  specific binaries or machine code
  4. binaries executes on a single platform















 On other hand java works:
  1. write source code
  2. compile source code 
  3. run any platform














The "javap -c" command disassembles a class file. Disassembling done by Disassembler which converts machine language to assembly language.


No comments:

Post a Comment