What is the difference between JDK and JRE?
What are their roles and when should I use one or the other?
If you are a Java programmer you will need JDK in your system and this package will include JRE and JVM as well but if you are normal user who like to play online games then you will only need JRE and this package will not have JDK in it.
JVM
JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.
JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.
JRE
It contains everything you need to run Java applications in compiled form. You don't need any libraries and other stuffs. All things you need are compiled.
JRE is can not used for development, only used for run the applications.
Java SE Development Kit (JDK)
The JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.
(Sources: GeeksForGeeks Q&A, Java Platform Overview)