Exforsys.com
 
Home Tutorials J2EE
 

Java Virtual Machine

 

Java Virtual Machine

The Java Virtual Machine, also known as JVM, was created by Sun Microsystems, and is basically a virtual machine which runs Java bytecode. The Java bytecode will be created by Java compilers. However, it should be noted that compilers for other languages have also been used as well.



The JVM is an important part of Java. The existence of JVMs on numerous different devices and software programs has allowed programs written in Java to be run on a large number of devices. You can write a single program with Java, and then that program can be run on numerous operating systems.

Since the release of J2SE 5, the updates of the Java Virtual Machine have been made by the Java Community Process. A number of changes are being made in 2006, which should allow effective implementations. Sun has been running a series of tests to make sure the implentations for the JVM are working correctly. These changes have been requested for the class file format. If you want a program to run with the Java Virtual Machine, it will need to be compiled into a specific format which is binary. This means it will typically have to be a .class file type. An application can have a large number of classes, but each class will have to be placed in a unique file. To make programs easier to transfer, the class files may need to be placed within a .jar file.

Once this has been done, the binary will be initiated by the Java runtime. This runtime will perform an emulation of the instructions by reviewing it or by adding a just in time compiler, which is also known as JIT. An example of a popular JIT is HotSpot by Sun. Because the Java bytecode is based on a stack, the Java Virtual Machine will use what is called a stack structure. However, a JIT compiler will process the code into machine code. Every thread will use a stack and program counter which is unique. Before bytecode can be initiated, the Java Virtual Machine must verify it. Because of this, there is a limit to the amount of bytecode which can be sequenced from a specific program.

Even though the Java Virtual Machine uses a stack structure, this doesn't mean that the developer will see a problem with speed when it comes to emulation. Verifying the code will also allow the JVM to make sure the bit patterns are not used for an address. Memory protection will be offered, and the developer doesn't need to have access to a MMU. Because of this, the Java Virtual Machine is a simple way to get protection for the memory without using a MMU. There are a number of jobs that the JVM must carry out. It will need to store and load data, and it will also need to perform arithmetic operations.

The JVM must also deal with the conversion of type and the creation and control of objects. In addition to this, it will also need to deal with control transfers and throwing exceptions. The goal of the Java Virtual Machine is to make sure the code is compatible with the hardware or software that it is being converted into. For example, each OS will need to have an implentation for JVM that is unique. While the JVM will always study the bytecode in the same way, the implementation of the code will likely be different. The most complicated aspect of this is the the use of the Java API. The API will need to be properly mapped for each OS.




It is also important to make sure the code is initiated in a secure manner. The structure of the Java Virtual Machine will give a high level of control over the behavior of the code. The goal of this is to make sure the code is initiated correctly. This is especially important when code is being taken from unknown sources. The Java applets are well known for this. The Java applet works with the browser of a user, and it will initiate code which is downloaded from a distant server that uses HTTP. This code will be transferred in a restricted manner in order to protect the user.



Read Next: What You Can Do To Deal With Java's Memory Retention Problems



 

 

Comments


mrinmoy panja said:

  Nice presentation style, for beginner it's very helpful.
September 7, 2007, 6:18 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2010 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape