Download and Install JDK

To develop Java programs we require the JDK (Java Development Kit). JDK contains the development tools that are useful for compiling Java programs or debugging or various other tools available. JDK will have compiler and runtime environment, which will help us write Java programs and execute them.

When JDK is installed, it will also come with Development Tools and JRE (Java Runtime Environment). JRE in turn will contain Java Class Library and JVM (Java Virtual Machine):

Image illustrating how JDK is structured, with JVM inside JRE and JRE inside JDK.
Diagram illustrating how JDK is structured, with JVM inside JRE and JRE inside JDK.

Once the program has been compiled, it has to be executed. To execute a Java program, we require JVM, which is a part of JRE.

Say we have a program file 'First.java', we use a compiler to compile the program, the Java compiler javac comes as part of JDK. Once the program has been compiled, we will get a file called 'First.class'. Use the command java First to execute the program, this will use the JRE which internally it uses JVM. javac compiler is a development tool that comes as part of JDK and java is the Java launcher, which will start runtime environment.