HOW JAVA IS PLATFORM INDEPENDENT ?
The developers of java have made compilers and java virtual machines(also known as JVM). The function of compiler is to convert the program written by the programmer in the syntax of java into byte-code. Though the programmers don't have to do anything with the byte-codes so produced by the compilers, but for the sake of general knowledge, the programmer must know that it is the compilers which are platform dependent. You must have noticed while downloading java-sdk kit from the oracle website. The website provides different kinds of compilers for different platforms such as windows, LINUX, UNIX, Machintosh. So, this means java developers bore this extra responsibility of writing different compilers for different platforms, so that you can both write and run a java program on any platform. All you need to worry about is just learning the syntax of java.
2nd PHASE AFTER BYTE-CODE FORMATION
When compilers perform their part of converting a program written in java to the byte-code, then this byte-code is fed to JVM(Java Virtual Machine) whose function is work on the byte-code and to convert it into such a form which can be understood by the computer hardware or the underlying machine. This form is referred as machine language. Java developers also take care to develop different JVM for different machines. So that your program written in java could run on any hardware. Your computer manufacturer could be any company such as Sony, Samsung, Lenovo, ASUS, etc. So there are JVMs available for all different machines.
The appropriate compilers and JVMs makes life easier for the programmers who write code in java and want their code to run everywhere irrespective of different platforms.
These striking features of java made the founders of java to raise the slogan :
"Write once run anywhere"
No comments:
Post a Comment