All accept Java as platform independent language and Java is popular because of it. But how Java becomes platform independent.
- When we write a code in Java, the source code is complied by the Java compiler (javac). Java compiler converts the source code into universal byte code or to a ".class" file that is standard for all platforms, machines or operating systems.
- There can be any number of JVM but they all understand the one common language called universal byte code and translates them into the binary executable of a particular platform for which they are developed.
- Java is an interpreter. This interprets the ".class" file based on a particular platform and executes them.
- Java Virtual Machine (JVM) comes into play. JVM for windows will be different from JVM for Solaris or Linux. But all the JVM take the same byte code and executes them in that platform.
Java Source Code ==> Java Compiler ==> Universal Byte Code ==>Java or JVM ==> Execution
There is separate development section in Sun Microsystems to
develop the JVM for a particular platform. For each upgrade of the JDK,
the JVM for each platform is updated.
No comments:
Post a Comment