The Java Virtual Machine Specification provides the hardware platform specification to which you compile all Java technology code. This specification enables the Java software to be platform-independent because the compilation is done for a generic machine know as the JVM. You can emulate this generic machine in software to run on various existing computer system or implement it in hardware.
The compiler takes the Java application source code and generates bytecodes. Bytecodes are machine code instructions for the JVM. Every Java Technology interpreter, regardless of whether it is Java Technology development tool or a web browser that can run applets, has an implementation of the JVM.
The JVM specification provides concrete definition for the implementation of the following
The code format of the JVM machine consists of compact and efficient bytecodes. Programs represented by JVM bytecodes must maintain proper type discipline. The majority of type checking is done at compile time.
Any compliant Java technology interpreter must be able to run any program with class files that conform to the class file format specified in The Java Virtual Machine Specification.
The JVM design enables the creation of implementation for multiple operating environments. For example, Oracle provides implementation of the JVM for the Solaris OS and the Linux and Microsoft Windows operating system.
When Java source file is compiled, .class file created which means they are converted into set of bytecodes from the text format in which you write them. The bytecodes are stored as .class files.
At runtime, the bytecodes that make up the software are loaded,verified and then run in the interpreter which is the JVM. In the case of applets,the bytecodes are downloaded and they are run by the JVM integrated with the browser.JVM makes appropriate call to the underlying hardware when necessary. In short, JVM is an instance of JRE.
JDK contains JRE along with various development tools, Java libraries,Java source compiler,Java debugger and deployment kit.