This problem usually appears if there are some problems with your system environment variables concerning Java. It is pretty simple to resolve, you just have to check whether your variables are correct.
To open the list of environment variables follow Windows Control Panel –> System –> Advanced System Settings –> Environment Variables.
Check through the list to find these two variables:
The first one should refers to the jre folder of your Java installation, for example:
While the second one should refers to the bin\server subfolder of Java installation, for example:
Pay attention to these variables and you will avoid such Java issue.
Using materials of eng-tips.com