
The reason for this error could be that you don’t have Java at all in your PC or JAVA_HOME and PATH variables are not set up properly.

In my case, my PC was not having Java installed. So I went with OpenJDK from Eclipse foundation. So by performing the following steps, it solved the problem.
- Download AdoptOpenJDK, I selected .msi version for my x64 PC.
- On the Custom Setup screen, select “Set JAVA_Home variable” and “JavaSoft (Oracle) registery keys”

- Let the installer setup JAVA_HOME and PATH system variables

- Give a restart to your PC (better do it with Windows :p)
- Verify in command prompt to see if this JDK version is reflecting

- Run your application.