Java is a programming language and platform released by Sun Microsystems in 1995. Java is secure, fast, and reliable programming language. Platform means any h/w or s/w environment in which a program runs. Java has its own runtime environment i.e. JRE and API it is called platform.
Java is everywhere from PCs to Mobile phone, satellites, other electronic devices. There are many applications and websites that will not run without java installation on your machine.
Java is the combination of two things:
- A Programming language
Features of Java
Features are as follows:
- Platform Independent
- Dynamic, Interpreted
- High Performance
In 1991 java was started initially it was called as “Oak” by James Gosling. The main goal to implement a virtual machine with programming language is that it can support platform independency, secure, and fast. Java first publication 1.0 was released in 1995 by Sun Microsystems. The main concept of java is “Write Once, Run Anywhere”. Almost all syntaxes is similar to C and C++ programming languages.
Internals of Java Program
Java Class loading is one of the most powerful mechanisms. Before going to understand this concept you have to know what is .java and .class. .java is source code file and .class is binary file after compiling .java is .class will generated by the java compiler. Internally java virtual machine has two different tools such as compiler and interpreter. When you are going to compile a .java you have to use compiler then, when you are going to execute you should depends on interpreter. Here interpreter will loads .class. .class represents the code to be executed data represents the state associated with the code. Once a class is loaded into JVMsame class will not be loaded again in similar JVM. Class loads into JVM with a specific identity. Class is identified by its completely qualified name like:
public class SampleClass
In the above example “SampleClass” is a class name. In JVM it will identified uniquely qualified with classname or classname with packagename with the instance of the ClassLoader that loaded the class. In JVM each class is loaded by some instance of a “java.lang.ClassLocader”. It is located in “java.lang” package and developer are free to subclass it to add their own logic to class loading.
Difference between JDK, JRE and JVM
Before going to understand difference between JVM, JDK and JRE you have to about what it is.
JDK: Java Development Kit is a program development environment for writing Java desktop and web applications. It consists of a runtime environment that sits on top of the operating system layer as well as the tools and programming that developers need to compile, debug and run applications written in Java languages.
JRE: Java Runtime Environment, also known as Java Runtime, it is part of the Java Development kit, a set of programming tools for developing Java applications. Java Runtime Environment provides the requirements such as core classes, supporting library file for executing a Java application.
JVM: Java Virtual Machine interprets compiled Java binary code for a processor so it can perform a java program’s instructions. Specification specifies an instruction set of register, stack, and garbage heap and method area. JVM can interpret the byte code one instruction at a time or the byte code can be compiled further for a real processor using a Just-In-Time Compiler.
Just-In-Time: Java programming language environment, Just-In-Time compiler is a program that converts java byte code into instructions that can be sent directly to the processor.
Table: Difference between JVM, JDK, and JRE
|It is an abstract machine. It gives runtime environment in which byte code can execute.JVM is platform dependent because configuration and file format of each operating system is different.JVM performs Load, Verify, and Execute code and provides runtime environment.||It used to provide Runtime Environment.It is the implementation of JVM.It contains set of libraries and core classes.It physically exists.||It contains JRE and development tools.Java Development Kit is a bundle of Java Compiler, Java Interpreter, Java Disassembler, Java Header File Generator, Java Documentation, Java Debugger, Java Applet viewer, JRE.|
Internal Details of JVM
Java Virtual Machine is a software implementation of a machine that executes java programs like a physical machine. Originally java was designed to run on a virtual machine which is separated from a physical machine. JVM has features which are mentioned below:
- Stack-based virtual machine: Most popular computer architectures run based on register. JVM runs based on a Stack.
- Symbolic Reference: Class and interfaces referred to through symbolic reference instead of through explicit memory address based references.
- Garbage Collection: Class instance is created by the user code and automatically destroyed by garbage collection.
- Network Byte Order: Class file uses the network byte order to keep platform independence between architectures.
This blog will help you get a better understanding of Java Mapreduce Tutorial!