简体   繁体   中英

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:

在此处输入图片说明

I have already installed JRE and JDK.

UPDATE: Eclipse.ini contents:

   -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:

  • The -vm option and its value (the path) must be on separate lines.
  • The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
  • The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.

Source: Eclipse Wiki

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.

Reference the location of your JRE path in the eclipse configuration file, eclipse.ini .

Note that you only need a JRE to launch Eclipse, but once Eclipse is launched, you should register a JDK for your projects. This is done via

Preferences-> Java -> Installed JREs

Same happened with me on win7. I had 2 folders for 'program files'

  1. Program files
  2. Program Files(x86)

java folder was present on both. For environment variables, I have given the path of java from program files(x86)...\\jre6\\bin. Then I had downloaded new java 7 version update. Then had tried to open eclipse, it worked and i had not made any changes to eclipse.ini file. My eclipse.ini didnt have any reference to the -vm argument.

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 :

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

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 :

before I change the path was :

-vm

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

-vmargs

-Dosgi.requiredJavaVersion=1.7

-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 :

-vm

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

-vmargs

-Dosgi.requiredJavaVersion=1.8

-Xms256m

-Xmx1024m

Nice Day :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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