Saturday, July 9, 2011

Java architecture

According to Sun Microsystems the Java architecture comprises of four components.Each of them is defined by Sun Microsystems.

The Components are:-

1 .Java Programming Language
2 .Java class file format
3. Java Virtual Machine
4. Java (API) Application Programming Interface.
Every Java program uses features of all the four components.They are used in following sequence:-

We write code in Java programming Language.
When we compile the .java file it creates a new file which is called as the class file(also called bytecode).
The .class file(or class file) is executed by the JVM.
When we execute the program the method calls are made through the Java API.The above

Sequence may be represented as following block diagram:-

Representing the same by flow diagram:

You can think of Java bytecodes as the machine code instructions for the Java Virtual Machine (Java VM). Every Java interpreter, whether it's a Java development tool or a Web browser that can run Java applets, is an implementation of the Java VM. The Java VM can also be implemented in hardware.
Java bytecodes help make "write once, run anywhere" possible. You can compile your Java program into bytecodes on any platform that has a Java compiler. The bytecodes can then be run on any implementation of the Java VM. For example, the same Java program can run on Windows NT, Solaris, and Macintosh.

The JVM and the Java API forms the basic Java runtime system and is must to execute any java program.The specification provided by the Sun Microsystems only lists the components features but this specification lacks the way how these features to be implemented.The implementation is always left to the designers.The JVM is provided by many vendors, mostly it comes along with the Operating System.All the JVM's must have some unique features that is why it is said that "Threads are JVM behaviour dependent".So its important to figure out how your JVM performs internal task of scheduling,memory related issues and other performance matrices.Although the JVM vendors and JVM functioning is a bit different but still all of them follow the Sun Microsystems Specification for Java Architecture.

No comments:

Post a Comment