How Java Virtual Machine (JVM) Works

by Shabbir on March 17, 2009

in Java

Bytecode helps to solve Java's portability and security problem. It is a highly optimized set of instructions designed  to be executed by Java run-time system,which is called as  Java Virtual Machine (JVM).JVM is an interpreter for bytecode,it helps to solve major problems associated with downloading programs over the Internet .

Let us see portability and security in details:-

1. Portability

Translating Java programs into bytecode helps makes it much easier to run in a wide variety of environments,only JVM needs to be implemented for each platform . Once the runtime package is present on the given system then any Java program can run on that system. Though JVM differ from platform to platform ,all interpret the same Java bytecode.If a Java program could have compiled to native code,then different versions  of same program would have been present which could have create a lot of problem to portable programs so,the interpretation of bytecode is the easiest way .

2.Security

The  interpreted Java program also helps to make it secure.Because the execution of every Java program  is under the control of JVM,the JVM can contain program and prevent it from generating side effects outside the system.When a program is interpreted it generally runs substantially slow than it would run if compiled to executable code. However,with Java the difference between the two is not so great . The use of bytecode enables the Java runtime system to execute  programs much faster than you might expect.

When Just In Time(JIT)  compiler is a part of the JVM,it compiles bytecode into executable code in real time,on a piece-by-piece ,demand basis.It is important to understand  that it is  not possible  to compile  an entire Java  program into executable code all at once ,because Java programs perform various run-time checks that can be done only at run time.Instead JIT compiles the code as it is needed during execution and the increase the performance of Java

Share:
  • Digg
  • Facebook
  • StumbleUpon
  • Technorati
  • Twitter

Most Commented Posts

Want More Tips on How to Make Money Online?
Enter your Name and Email below to subscribe and start 1 month free course now.

Name:
Email:
You would require to confirm your email address before we send you any updates. We respect your privacy as much as you do.
Powered by Aweber
  • Hafeez
    Just JVM defination or explanation?
    Gives some codes some definations.
    I mean inheritance polymorphism,interface,classess and much more.
blog comments powered by Disqus

Previous post:

Next post:

    About the Author

  • author photo

    My Name is Shabbir Bhimani and I am developer by profession in the field of applications, web and database. Currently doing full time online marketing and like to share my experiences on how you can make money online @ CodeItWell.com. Read more ...


    See how you can get in touch with me.