+ 29
JVM- JRE and JDK ?
Hello i am beginner in java language and i want to know what is the main difference between JVM- JRE and JDK ? and what is the role of each one ? - need a sample example please
5 Answers
+ 27
JVM
TheĀ Java Virtual machineĀ (JVM) is the virtual machine that runs the Java bytecodes. The JVM doesn't understand Java source code, that's why you compile yourĀ *.javaĀ files to obtainĀ *.classĀ files that contain the bytecodes understood by the JVM. It's also the entity that allows Java to be a "portable language" (write once, run anywhere). Indeed, there are specific implementations of the JVM for different systems (Windows, Linux, MacOS,Ā see the Wikipedia list), the aim is that with the same bytecodes they all give the same results.
JDK and JRE
To explain the difference between JDK and JRE, the best is to read theĀ Oracle documentationĀ and consult the diagram:
Java Runtime Environment (JRE)
The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language. In addition, two key deployment technologies are part of the JRE: Java Plug-in, which enables applets to run in popular browsers; and Java Web Start, which deploys standalone applications over a network. It is also the foundation for the technologies in the Java 2 Platform, Enterprise Edition (J2EE) for enterprise software development and deployment. The JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications.
Java Development Kit (JDK)
The JDK is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.
Note that Oracle is not the only one to provide JDKs.
+ 6
JDK, JRE and JVM are core concepts of Java programming language. Although they all look similar and as a programmer we donāt care about these concepts a lot, but they are different and meant for specific purposes.
Java Development Kit is the core component of Java Environment and provides all the tools, executables and binaries required to compile, debug and execute a Java Program. JDK is a platform specific software and thats why we have separate installers for Windows, Mac and Unix systems.
JVM is the heart of java programming language. When we run a program, JVM is responsible to converting Byte code to the machine specific code. JVM is also platform dependent and provides core java functions like memory management, garbage collection, security etc. JVM is customizable and we can use java options to customize it, for example allocating minimum and maximum memory to JVM.
JRE is the implementation of JVM, it provides platform to execute java programs. JRE consists of JVM and java binaries and other classes to execute any program successfully. JRE doesnāt contain any development tools like java compiler, debugger etc.
See more in detail: http://crbtech.in/Java-Training/difference-java-jdk-jre-jvm/
+ 3
Differences between JDK, JRE and JVM
JAVA DEVELOPMENT KIT
The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc) and other tools needed in Java development.
JAVA RUNTIME ENVIRONMENT
JRE stands for āJava Runtime Environmentā and may also be written as āJava RTE.ā The Java Runtime Environment provides the minimum requirements for executing a Java application; it consists of the Java Virtual Machine (JVM), core classes, and supporting files.
JAVA VIRTUAL MACHINE
It is:
A specification where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Sun and other companies.
An implementation is a computer program that meets the requirements of the JVM specification
Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created.
+ 3
JDK=JRE+Development Tools
JRE=JVM+JAVA LAIBRARY