I am using Windows 8.1 environment. I had the same problem while running my first java program after installing Eclipse recently. I had installed java on d drive at d:\java. But Eclipse was looking at the default installation c:\programfiles\java. I did the following:
Modified my eclipse.ini file and added the following after open:
-vm
d:\java\jdk1.8.0_161\bin
While creating the java program I have to unselect default build path and then select d:\java.
After this, the program ran well and got the hello world to work.