简体   繁体   English

未找到在 Windows 7 JRE 和 JDK 上运行 Eclipse

[英]Running Eclipse on Windows 7 JRE and JDK not found

I downloaded the latest Eclipse on Windows 7. When I click the eclipse icon it throws the following exception:我在 Windows 7 上下载了最新的 Eclipse。当我单击 eclipse 图标时,它会引发以下异常:

在此处输入图片说明

I have already installed JRE and JDK.我已经安装了 JRE 和 JDK。

UPDATE: Eclipse.ini contents:更新:Eclipse.ini 内容:

   -startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
-vm C:\Program Files (x86)\Java\jre7\bin

According to the Eclipse documentation, you may need to specify the VM before the VM args, and the path should not be on the same line as the -vm switch:根据 Eclipse 文档,您可能需要在 VM args之前指定 VM,并且路径不应与 -vm 开关在同一行:

  • The -vm option and its value (the path) must be on separate lines. -vm 选项及其值(路径)必须在不同的行中。
  • The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.该值必须是 Java 可执行文件的完整绝对或相对路径,而不仅仅是 Java 主目录。
  • The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM. -vm 选项必须出现在 -vmargs 选项之前,因为 -vmargs 之后的所有内容都直接传递给 JVM。

Source: Eclipse Wiki资料来源:Eclipse 维基

For example:例如:

-vm
C:\Java\JDK\1.6\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m

You also might need to surround your path with some quotes, since it contains spaces.您可能还需要用一些引号将路径括起来,因为它包含空格。 I always install things like Eclipse and Java in root directories with no spaces, not under Program Files , to avoid this problem.总是在没有空格的根目录中安装 Eclipse 和 Java 之类的东西,而不是在Program Files ,以避免这个问题。

Reference the location of your JRE path in the eclipse configuration file, eclipse.ini .在 eclipse 配置文件eclipse.ini引用JRE路径的位置。

Note that you only need a JRE to launch Eclipse, but once Eclipse is launched, you should register a JDK for your projects.请注意,您只需要一个JRE来启动 Eclipse,但是一旦 Eclipse 启动,您应该为您的项目注册一个JDK This is done via这是通过

Preferences-> Java -> Installed JREs

Same happened with me on win7.我在win7上也是这样。 I had 2 folders for 'program files'我有 2 个文件夹用于“程序文件”

  1. Program files程序文件
  2. Program Files(x86)程序文件(x86)

java folder was present on both. java文件夹存在于两者上。 For environment variables, I have given the path of java from program files(x86)...\\jre6\\bin.对于环境变量,我已经从程序文件(x86)...\\jre6\\bin 中给出了 java 的路径。 Then I had downloaded new java 7 version update.然后我下载了新的 java 7 版本更新。 Then had tried to open eclipse, it worked and i had not made any changes to eclipse.ini file.然后尝试打开 eclipse,它工作正常,我没有对 eclipse.ini 文件进行任何更改。 My eclipse.ini didnt have any reference to the -vm argument.我的 eclipse.ini 没有任何对 -vm 参数的引用。

I have the same of problem because I was have both the java 1.7 and the java 1.8 and I solved the problem By :我有同样的问题,因为我同时拥有 java 1.7 和 java 1.8,我解决了这个问题:

for windows :对于窗户:

first :第一的 :

open your CMD and write java -version the result is the current version of java on your pc for exampe the result is 1.8 so打开你的CMD并写java -version结果是你电脑上的当前 java 版本,例如结果是 1.8 所以

second第二

open the eclipse.ini and if the path was not the path of current version java (that shown in result of CMD) edit the path to correct path of your java (the version shown in result ) like this :打开eclipse.ini ,如果路径不是当前版本java的路径(显示在CMD的结果中)编辑路径以正确的java路径(结果中显示的版本),如下所示:

before I change the path was :我改变路径之前是:

-vm -vm

C:\\Program Files\\Java\\jdk1.7.0_45\\jre\\bin\\javaw.exe C:\\Program Files\\Java\\jdk1.7.0_45\\jre\\bin\\javaw.exe

-vmargs -vmargs

-Dosgi.requiredJavaVersion=1.7 -Dosgi.requiredJavaVersion=1.7

-Xms256m -Xmx1024m -Xms256m -Xmx1024m

after I check of my version of java using CMD the result is : java 1.8 so I change the path and version like this :我使用 CMD 检查我的 java 版本后,结果是:java 1.8 所以我改变了路径和版本,如下所示:

-vm -vm

C:\\Program Files\\Java\\jdk1.8.0_45\\jre\\bin\\javaw.exe C:\\Program Files\\Java\\jdk1.8.0_45\\jre\\bin\\javaw.exe

-vmargs -vmargs

-Dosgi.requiredJavaVersion=1.8 -Dosgi.requiredJavaVersion=1.8

-Xms256m -Xms256m

-Xmx1024m -Xmx1024m

Nice Day :)美好的一天:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM