Eclipse will by default try to launch with the default "java.exe" (the first one referenced by your PATH)
Three things to remember:
PATH to update.
June 2012, jmbertucci comments:
I'm running Windows 7 64-bit and I had the 32-bit JRE installed. I downloaded Eclipse 64-bit which looks for a 64-bit JRE. Because I didn't have the 64-bit JRE it threw the error, which makes sense.
I went to the Java manual install page (which was not as directly accessible as you'd like) and installed the 64-bit version. See "Java Downloads for All Operating Systems". That was all I needed.
April 2016: Steve Mayne adds in the comments:
I had to edit the
eclipse.inifile to reference the correct Java path - Eclipse doesn't use the environmentPATHat all when there is a value ineclipse.ini.
Just copy this file :
c:/Program Files/Java/jre(5,6,7..any version)/bin/javaw.exe
to Eclipse Folder
*note only tested for Windows

All the other answers about setting only the JAVA_HOME are not entirely right. Eclipse does namely not consult the JAVA_HOME. Look closer at the error message:
...in your current PATH
It literally said PATH, not JAVA_HOME.
Rightclick My Computer and choose Properties (or press Winkey+Pause), go to the tab Advanced, click the button Environment Variables, in the System Variables list at the bottom select Path (no, not Classpath), click Edit and add ;c:\path\to\jdk\bin to the end of the value.
Alternatively and if not present, you can also add JAVA_HOME environment variable and make use of it in the PATH. In the same dialogue click New and add JAVA_HOME with the value of c:\path\to\jdk. Then you can add ;%JAVA_HOME%\bin to end of the value of the Path setting.
Open up Windows' System Properties from the control panel and hunt down the environment variables section:
Most Java tools will now be able to find your Java installation either by using the JAVA_HOME environment variable or by looking for java.exe / javaw.exe in the Path environment variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With