Please refer to my article to configure the JDK environment, any problem message:
1. If you want to develop Java, you need to install and configure JDK, including JRE(Java Running environment)
2. If you only use java server or application as running environment, you can install and configure JRE.
Also: Most JRE environments that Java open source frameworks rely on are indexed from JAVA_HOME, and many typical Java service frameworks are indexed directly from JRE_HOME.
If you make your own standard Java application(for example, a jar file that includes the java main method using only the standard java library), you can customize the dependency on HRE_HOME. Example: Java Server