3

Java is a platform independent language. But, JVM is machine dependent. So, my question is: Which parts of java are platform independent? JRE, JDK or JVM? Please Explain.

1
  • 1
    The JRE is machine dependent (it's a runtime environment). The JDK is a JRE + a compiler (written in Java). The JVM is (basically) a specification. Commented Jan 28, 2017 at 4:09

3 Answers 3

6

JVM , JRE , JDK these are all the backbone of java language. Each components work separately . JDK and JRE physically exists but JVM is an abstract machine that means it has not physically exists.

enter image description here

JVM

JVM (Java Virtual Machine) is a software. It is a specification that provides runtime environment in which java bytecode can be executed. It is not physically exists.

JVMs are not same for all hardware and software, for example for windows os JVM is different and for Linux JVM is different. JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.

JRE

The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK). It contains set of libraries and tools for developing java application. The Java Runtime Environment provides the minimum requirements for executing a Java application. It physically exists. It contains set of libraries + other files that JVM uses at runtime.

enter image description here

JDK

The Java Development Kit (JDK) is primary components. It physically exists. It is collection of programming tools and JRE, JVM.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

My question is rather a philosophical one. What does it mean that JVM doesn't exist physically? (I get that it is a specification, so it means the specifications are written somewhere, which are not abstract, so how does it not exist physically?)
2

All 3 are platform dependent.

  1. JVM -> platform dependent.
  2. JRE -> consists of JVM and some other things. Since it include JVM, it is platform dependent.
  3. JDK -> consists of JRE, compiler and some other things. Since it includes JRE which in turn includes JVM, it is platform dependent.

The java code before and after compilation is platform independant. You can compile on windows and run the byte code on unix using Unix's jvm.

Comments

0

JDK and JRE ---> Platform dependent, these are specific to different system. JVM ---> Platform independent, because JVM is specifications for JRE. It means JVM has some set of rules and JRE is giving the implementation to it. So, JRE is physical implementation of JVM.

Ex- Bank has some specific rules and SBI, BOI and UCO are the implementation for the Bank. Here in this case BANK is JVM and SBI, BOI and UCO are JRE.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.