Thursday, December 4, 2014

JDK, JVM, JRE a deeper look

Many of us have seen the error in web pages to install Java. What you simply do is click on the error and it opens a website to download Java. You download Java, install it and restart the web browser. This is very common scenario. Isn’t it?

But there is a lot more than it. If you are following this series, then you can recall that, I asked you to download JDK and not Java.

So, what is the difference?
Yeah, there are differences, you should be clear on. Actually to work with Java, you need to be clear about 3 terms, JRE, JDK and JVM. It’s good if you don’t confuse them or mix them altogether.

  • JVM – Java Virtual Machine (JVM) is an executable program that interprets the byte code generated by the compiler and generates machine code and directly given to OS for execution. Below picture depicts this fact.

          JVM is also responsible for memory management, Garbage collection, security and other                     system         level services.

  • JRE – Java Runtime Environment (JRE) is JVM bundled with some runtime libraries like, deployment tools, Integration libraries, user interface libraries etc.
          JRE = JVM + Runtime libraries
  • JDK – Java Development Kit (JDK) is JRE bundled with development tools like javac, javap, debugger tools, wsimport.
          JDK = JRE + Development tools.

In a nutshell, JDK is the superset, where JRE is a subset of JDK and JVM is a subset of JRE. The below picture depicts this fact where the most outer grey part is JDK, the inner blue part is JRE and the inner most pale blue part is JVM.

If you are an advanced programmer, you can take a look on the oracle documentation here.

Prev     Next

Palash Kanti Kundu

No comments:

Post a Comment