|
This section introduces you with JAVA. Java is an Object Oriented Programming similar to C++ and Smalltalk. But JAVA is platform independent and follows the principle of WORA ( Write Once and Run Anywhere). It is unlike C, C++ which means that you write a JAVA program and compile it only once and run it on any operation system be it Windows, Linux, Solaris etc. If we talk about C++ then it is not all platform independent because needs to be compiled on each operation system in order to execute the program on different operation system. We will discuss this in detail in section Java Virtual Machine that how it achieve such a platform independence where as C, C++, FORTRAN, VB, VC++ and many others.
|
|
History of Java
|
|
Java was conceived by James Gosling, Patrick Naughton,
Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems,
Inc. in 1991. It took 18 months to develop the first working
version. This language was initially called “Oak” but was
renamed to “Java” in 1995 due to a patent search which
determined that the name was copyrighted and used for another
programming language. Between the initial implementation of Oak
in the fall of 1992 and the public announcement of Java in the
spring of 1995, many more people contributed to the design and
evolution of the language. Bill Joy, Arthur van Hoff, Jonathan
Payne, Frank Yellin, and Tim Lindholm were key contributors to
the maturing of the original prototype.
|
|
Modern Java
|
Java has travelled a long way and it has made a mark of presence in 21st Century. Today, Java is used for many type of applications like embedded applications, financial applications, desktop applications, flight simulators, Image Processors, Games, distribute enterprise applications called J2EE and many more.
|
|
Java Virtual Machine (JVM)
|
Java Virtual Machine is a small application mainly written in C language that needs to be installed in order to execute JAVA programs. Whenever a Java program is compiled it is converted into BYTE CODE. Further when java program is executed, JVM executes those byte codes and converts them into machine language understood by the underlying operating system. Since JVM is platform dependent it makes Java platform independent. Byte codes produced during compilation are always same for all operting systems but since JVM is platform dependent it reads those byte codes and convert them into the machine language for which the JVM has been designed. eg. JVM built for Linux operating system will convert the byte codes into machine language understood by Linux and the underlying machine hardwares.
|
|
Just In Time Compiler (JIT)
|
Although Java was designed for interpretation, there is technically nothing about Java that prevents on-the-fly compilation of bytecode into native code. Sun provides its Just In Time (JIT) compiler for bytecode which when included in the JVM, it compiles bytecode into executeable code in real time one by one as the program demands. The JIT compiles code as it is needed during execution. However, the just-in-time approach still yields a significant performance boost. Whether your Java program is actually intepreted in the traditional way or compiled on the fly its functionality is the same.
|
Suppose there are to files (Java class) which are used by a Java program will be loaded into the memory one by one on a demand basis. JVM will not check for the availablity of the files before executing the code. In case if it is not able to find the required file in between the execution of the program, JVM will throw an exception saying that it has not found the file and exit the program from that point. The program will not complete successfully.
|
|