if I install JDK do I also need to install JRE

Solution 1:

You do not need to install JRE then, as JDK usually consists of both development & run-time environments in it. If you install JDK then JRE will already be packaged in it and installed automatically along with JDK.

Generally to do javac <filename.java>, you need to have JDK which already has JRE in it. To do java filename you need only JRE.