Java is one the oldest and most sophisticated programming languages with an excellent reputation - "write once, run anywhere". In fact it was the basis for most sophisticated computer games and it is still used extensively for software and server applications. However it is no longer installed on generic computers and notebooks by default because modern web browsers can no longer run Java applets.
So to run Java apps, you need to install the Java Runtime by downloading it from java.com - look for installers named like "jre-8u321-windows-x64.exe"
After installing the Java JRE and restarting your computer, you should be able to run your Java app.
Error
If you find that Java apps still won't run, giving errors about "JRE cannot be located"...
Explanation
The system relies on environment variables, particularly JAVA_HOME and Path, to locate the JRE. If these are not set correctly, or if the path specified in them is invalid, the system will not find Java.
Solution
- Right-click "This PC" or "My Computer" and select "Properties."
- Click "Advanced system settings" and then "Environment Variables."
- Under "System Variables," check for JAVA_HOME. If it doesn't exist, create a new variable with the name JAVA_HOME and the value as the path to your JRE installation directory (e.g., C:\Program Files\Java\jre-1.8).
- Edit the Path variable and add %JAVA_HOME%\bin to the list of paths.
- Open a new command prompt to verify the changes using echo %JAVA_HOME% and java -version.
If a Java version is reported, you should now be ready to go, but a restart might be required.