The most popular feature that separates the Java from other languages is the Platform independent feature .
Java is based on compiled once and run anywhere principle . So one question come into mind , how it is possible java is able to achieve platform independent while other languages not. The workaround is this that the java creators create the run time environment for each platform , or in other words , they created jre for each operating system . So once you compile the code , the java code is converted into machine language readable form that is byte code form .
Understanding Java Compiler
There are predefined conditions which need to be implemented in order to not to get a error from the java compiler
We need to understand compiler as a doctor which tells the patient (here java program )that where the problem lies, if there is clearance from the doctor (compiler) then the patient(java program) is free to execute in any environment .
So whenever you think of compiler then think it as a doctor who is there to improve your program and make it free from syntax errors .
So in short ,
Compiler Java Runtime
program -----------> Byte Code ---------> Execute(.class file)
(patient ) (cured / feeling healthy )
Whenever we compile a java program , then a .class extension file also generated which is in the byte code format or the machine understanding format . This .class extension file is then executed in different environments to generate the output .
Java Runtime Environment (JRE)
The classes which are prebuilt or that are provided by the java originator , are placed in one jar called rt.jar .
rt.jar where rt extends for runtime that is the class files which are ready to be executed in the java runtime environment .
You can find the rt.jar here in your computer
C:\Program Files\Java\jre1.7.0\lib ( for windows user )
If you extract the rt.jar then you will find the six packages in it, namely ,
So it is better to understand jre like a governing body(BCCI , FIFA , FA , NFL , NBA) which provides the compiled code (byte code ) all the necessary things (ground,audience,playing kit etc ) so that it can successfully execute the program .
Most of us get confused when we heard the term IDE , what the hell is that , where it come from . So to make it simple , you can compare it to your school time copy or registers where you use them to write down the school topics or notes .But actually it is more than register . Similarly in simple words , IDE (Integrated Development Environment) which is used to write the java program and saves a lot of effort for the programmer by using shortcuts and in built functionality .
Examples of Java IDE :
* Eclipse (MyEclipse)
*IBM WebSphere Studio
JDK and JRE
JDK can be defined as java development kit and JRE as java runtime environment . There is not much difference between two . Actually in simple words , JRE is a subset of JDK or if JDK is a country than JRE is the state in that country . I hope you are now clear with the difference . Java development kit also provides the tool to compile the java program as well as the Environment to execute the java program . JRE does not have abilities to compile the java program , it just provide the environment to execute the byte code .
You can download the java jdk from the below link :