Right click on the Eclipse icon and select 'show package contents'. Inside the contents directory you'll find a file called 'Info.plist'. Scroll down to the bottom of the file till you find this
<key>Eclipse</key>
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java</string>
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
-->
Notice the commented out section. Move the jdk path declaration out of the comments section. It should look like this now.
<key>Eclipse</key>
<array>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java</string>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V
<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
-->
Last step, browse to /Library/Java/JavaVirtualMachines and check the jdk package name present there. Replace the jdk version in the above command with that.
/Library/Java/JavaVirtualMachines/{your_jdk_package_name}/Contents/Home/bin/java
Optional: On some machines you may have to close the finder after you've done all this, navigate to the eclipse folder and click on eclipse again for it to work.