如何解决It's likely you're attempting to run Eclipse using the JRE instead of the JDK

最近为了维护一个老项目,需要用到一个插件,在安装插件后运行该插件出现eclipse如下报错
It's likely you're attempting to run Eclipse using the JRE instead of the JDK.
如何解决It's likely you're attempting to run Eclipse using the JRE instead of the JDK
如何解决It's likely you're attempting to run Eclipse using the JRE instead of the JDK
具体原因是因为系统安装了最新的JDK1.8,可能JDK1.8对应的JRE有些东西改变了,JDK1.7时没遇到过这种问题。
解决方案一(成功解决问题):
启动eclipse时设置vm参数为javaw(java的窗口运行环境)
eclipse.exe -vm "c:\Program Files\Java\jdk1.8.0_60\bin\javaw.exe"
如何解决It's likely you're attempting to run Eclipse using the JRE instead of the JDK
如何解决It's likely you're attempting to run Eclipse using the JRE instead of the JDK
然后点击eclipse快捷方式启动即可

解决方案二
1. 配置环境变量(windows系统示例)
设置JAVA_HOME变量
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_101
设置PATH变量
PATH=%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
这里必须注意 JAVA_HOME的路径必须在SystemRoot路径之前,否则会出现运行报错

总结
本人最终选择第一种方案,使用eclipse快捷方式添加启动参数,避免更改windows环境变量引起其他问题。当然后来查看以后发现早已经添加了JAVA_HOME环境变量,只是在设置PATH时JAVA_HOME没有放在SystemRoot路径之前。