13 September 2009
0 Basic JAVA Tutorial - Platform Independence of JAVA
Basic JAVA Tutorial - CHAPTER-5 Platform Independence of JAVA and JVM
JAVA is Platform Independent
Java is a language that is platform independent.
• A platform is the hardware and software environment in which a program runs
• Once compiled, code will run on any platform without recompiling or any kind of modification.
– “Write Once Run Anywhere”
• JAVA Program Portability is made possible by making use of a Java Virtual Machine commonly known as JVM
Always keep onething in mind, only the programs written in JAVA language is portable, JVM or Java platform is not portable. These JAVA platforms are purely platform dependent, it will depend on the underlying Operating system and defenitely hardware also. That is, Windows OS has its own JVM, or JRE, and so as Mac, UNIX, LINUX etc
Java Virtual Machine (JVM)
The source code of Java will be stored in a text file with extension .java
• The Java compiler compiles a .java file into byte code
• The byte code will be in a file with extension .class
• The .class file that is generated is the machine code of the processor.
– Byte code is a binary language
• The byte code is interpreted by the JVM
• JVM varies from platform to platform, or, JVM is platform dependent
• JVM can be considered as a processor purely implemented with software.
• The interface that the JVM has to the .class file remains the same irrespective of the underlying platform.
– This makes platform independence possible
• The JVM interprets the .class file to the machine language of the underlying platform.
• The underlying platform processes the commands given by the JVM
0 comments:
Please give your valuable comments.