For more updates do follow us on Facebook,Twitter or Google+
Java Development Kit (JDK) consists of tools needed to create the Java programs,like Java libraries, Java compiler(javac.exe), Java debuggers, bundling and deployment tools.It also contains the JRE to run the java programs.We need to install the platform specific JDK like for windows,linux.We did installed the JDK while understanding the prerequisites for Selenium.
In nutshell JDK,is required to create our own java programs and to compile them as bytecode.Further we need JRE only for running the programs.
Javac:- Meaning Java Compiler,which takes programming code(java) as input and produces an executable code(bytecode) as an output.This is further executed by JVM into native code (machine code) as per the platform(windows,linux,mac,solaris)
ByteCode:-It is stored in .class file and cannot be read by standard CPU’s and needs to be translated into an instruction language that the underlying execution platform(Windows,linux) can comprehend.
we must have experienced this thing that while trying to run any java application on browser or in mobile,browser often suggest to download the JRE to run the program.
Thus JRE is targeted for execution of Java files i.e. JRE = JVM + Java Packages Classes( like math, lang, awt,swing etc)+runtime libraries. Java code comes in the bundled form of JAR (Java archive) files(remember we also used selenium JAR files to create test scripts)and we require Java virtual machine JVM to execute it.JRE is again platform dependent like JDK
JAVA virtual machine is the key for converting byte code into machine specific code.Moreover we have multifarious JVM as per the operating system like for Windows, Linux or Mac but one JAR(byteCode) can run on all these operating systems.
Java Virtual machine is at heart of Java programming language and provide several features to Java programmer including Memory Management and Garbage Collection, Security and other system level services.
JVM is the backbone of the “write once and run everywhere” principle in JAVA
1) Both JDK and JRE come as installer while JVM are bundled with them.
2) JRE only contain environment to execute java program but doesn’t contain other tool for compiling java program like JDK. In short JDK is for development purpose whereas JRE is for running of java programs.If we only need to run the Java code then JRE is recommended option but for full fledge development package JDK is preferred option.
3) JVM comes along with both JDK and JRE , it is like heart of java programming language and provides platform independence.
1)JIT (Just in Time) or dynamic compilation is part of JVM that optimizes bytecode to machine specific language compilation.
What happens is:- An JVM interpreter generates and executes the machine code instructions on the fly for each instruction, regardless of whether it has previously been executed.Now JIT caches the instructions that have been previously been interpreted to machine code, and reuses those native machine code instruction thus saving time and resources by not having to re-interpret statements that have already been interpreted by compiling similar bytecodes at same time, hence reducing overall time taken for compilation of bytecode to machine specific language.
2)Eclipse IDE comes with its own java compiler , it is different from javac, like it allows to run the code that did not actually properly compile and incase the error code block is never ran, our program would run fine.Further it comes with incremental feature, which allows our code to be pre-compiled as soon as we are finish typing.
Introduction to JAVA
DataType in Java