Java is a programming language which is general purpose, robust, secure, platform independent, multi-threaded, concurrent , and secure. Java comes with JDK, JRE and JVM.
JDK is a compiled version of platform dependent set of libraries which you can download from Oracle JavaSE website and install it in your machine to work with Java programming. Basically this comes with set of tools for debugging, compiling and monitoring java applications using JMX. Additionally it also provides JRE which is nothing but a Java Runtime Environment. Java Runtime Environment contains JVM and it basically executes the bytecode which is compiled from the Java Source Code.
Java is a platform independent language but JVM is not platform independent. It is basically a virtual machine which communicates with your local operating system for all kinds of operations we want to execute from Java programs like reading a file, connecting to a network or writing something on the stdout.
We write Java program using any editor, and then use javac provided in JDK to compile the program. Java Compilers generates the class code, which can be executes on the JVM. JVM reads bytecode and converts that into equivalent machine instructions and performs the system call. JVMs are programmed different for each operating system as the system call differs for operating system to control the hardware and so that makes JRE platform dependent and thus it makes java a platform independent programming language which compiles to bytecode which can run on any JVM.