简体   繁体   English

使用JRE路径设置Eclipse

[英]Setting up Eclipse with JRE Path

I have downloaded and extracted Eclipse. 我已下载并解压缩Eclipse。 I have Eclipse in the following directory: C:\\Applications\\eclipse . 我在以下目录中安装了Eclipse: C:\\Applications\\eclipse When I try and run the executable , I get the following message : 当我尝试运行可执行文件时,我收到以下消息:

系统路径中没有JRE

I currently have the following folder: 我目前有以下文件夹:

C:\Program Files (x86)\Java\jre7

Do I need to set up some environment variables for my Windows 7 OS to get Eclipse to run ? 我是否需要为Windows 7操作系统设置一些环境变量才能运行Eclipse? If so , may I please have some help to do this ? 如果是这样,我可以帮忙做一下吗? If not , can I please have some help to get Eclipse to run . 如果没有,我可以请一些帮助让Eclipse运行。

EDIT 编辑

I have changed the shortcut to include the path to the Virtual Machine , and am now getting this error : 我已更改快捷方式以包含虚拟机的路径,现在我收到此错误:

http://www.canning.co.nz/Eclipse/Eclipse_Message2.png http://www.canning.co.nz/Eclipse/Eclipse_Message2.png

You can add this line to eclipse.ini : 您可以将此行添加到eclipse.ini

-vm 
D:/work/Java/jdk1.6.0_13/bin/javaw.exe  <-- change to your JDK actual path
-vmargs <-- needs to be after -vm <path>

But it's worth setting JAVA_HOME and JRE_HOME anyway because it may not work as if the path environment points to a different java version. 但无论如何都值得设置JAVA_HOMEJRE_HOME ,因为它可能无法正常工作,就好像路径环境指向不同的java版本一样。

Because the next one to complain will be Maven, etc. 因为抱怨的下一个将是Maven等。

Add this to eclipse.ini: 将此添加到eclipse.ini:

-vm
your_java_path\bin\javaw.exe

...but be aware that you must add these lines before -vmargs ...但请注意,您必须在-vmargs之前添加这些行

I have several version of JDK (not JRE) instaled and I launch Eclipse with: 我有几个版本的JDK(而不是JRE)instaled,我启动Eclipse:

C:\eclipse\eclipse.exe -vm "%JAVA_HOME%\bin\javaw.exe" -data f:\dev\java\2013

As you can see, I set JAVA_HOME to point to the version of JDK I want to use. 如您所见,我将JAVA_HOME为指向我想要使用的JDK版本。

I NEVER add javaw.exe in the PATH. 我永远不会在PATH中添加javaw.exe。

-data is used to choose a workspace for a particular job/client/context. -data用于为特定作业/客户端/上下文选择工作空间。

Add the following -vm D:/Java/jdk1.6.0_30/bin/javaw.exe in the begin of eclipse.ini like this : 在eclipse.ini的开头添加以下-vm D:/Java/jdk1.6.0_30/bin/javaw.exe ,如下所示:

-vm
  D:/Java/jdk1.6.0_30/bin/javaw.exe
  -startup
  plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
  --launcher.library
  plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835
  -product
   org.eclipse.epp.package.jee.product
   --launcher.defaultAction
   openFile
   --launcher.XXMaxPermSize
   1024M
   -showsplash
   org.eclipse.platform
    --launcher.XXMaxPermSize
   1024m
    --launcher.defaultAction
   openFile
   --launcher.appendVmargs
   -vmargs
   -Dosgi.requiredJavaVersion=1.6
   -Xms1024m
   -Xmx2048m

This may sound dumb, but it may be a fresh, or damaged install, so is the JDK installed? 这可能听起来很愚蠢,但它可能是一个新的或损坏的安装,所以JDK安装? If not, go to the download site and download the latest version of Java JRE. 如果没有,请转到下载站点并下载最新版本的Java JRE。 Like I said, this may sound dumb, but it solved my problem. 就像我说的,这可能听起来很愚蠢,但它解决了我的问题。

http://www.oracle.com/technetwork/java/javase/downloads/index.html http://www.oracle.com/technetwork/java/javase/downloads/index.html

You should specify where Eclipse should find your JDK in the file eclipse.ini. 您应该在eclipse.ini文件中指定Eclipse应该在哪里找到您的JDK。 Specifically, the following parameter (note that it is 2 separate lines in the ini file): 具体来说,以下参数(注意它在ini文件中是2个单独的行):

-vm
C:\Java\JDK\1.8\bin\javaw.exe

or wherever your javaw.exe happens to be. 或者你的javaw.exe恰好在哪里。

Note: The format of the ini file is very particular; 注意:ini文件的格式非常特殊; make sure to consult https://wiki.eclipse.org/Eclipse.ini to ensure you get it exactly right 请务必查阅https://wiki.eclipse.org/Eclipse.ini以确保您完全正确

Add the following to the eclipse.ini : 将以下内容添加到eclipse.ini

-vm


Java_Home_Variable\bin\javaw.exe

In my Case its

-vm

H:\usr\java\jdk1.6.0_16\bin\javaw.exe

I had the same issue caused by two things: 我有两件事引起同样的问题:

  1. I had downloaded a 32bit Java version instead of 64bit. 我下载了32位Java版本而不是64位。
  2. The eclipse.ini did not have path to javaw.exe, so as per prior posts added the statement which points to the location java. eclipse.ini没有javaw.exe的路径,因此根据之前的帖子添加了指向java位置的语句。

So after I uninstalled the 32 bit Java 1.7, installed the correct one and added the javaw.exe path, eclipse fired up with no more errors 所以在我卸载32位Java 1.7后,安装了正确的一个并添加了javaw.exe路径,eclipse启动时没有更多的错误

You are most probably missing PATH entries in your windows. 您很可能在Windows中缺少PATH条目。 Follow this instruction : How do I set or change the PATH system variable? 请遵循以下说明: 如何设置或更改PATH系统变量?

I just copied the jre folder to whatever path the message tells me it was missing at, and solved it. 我只是将jre文件夹复制到消息告诉我它丢失的任何路径,并解决了它。

(after editing the JAVA_HOME and editing the eclipse.ini didn't worked (as i probably did something wrong)) (i have no other java applications running so it's not affecting me) (编辑JAVA_HOME并编辑eclipse.ini后没有用(因为我可能做错了))(我没有其他运行的java应用程序,所以它不影响我)

If you are using windows 8 or later: 如果您使用的是Windows 8或更高版本:

  1. download and install the jdk or jre with all the default settings and options. 使用所有默认设置和选项下载并安装jdk或jre。
  2. Then download and install eclipse. 然后下载并安装eclipse。

Everything should work fine. 一切都应该工作正常。 I don't know if it works exactly the same for other OS, but you don't have to set the PATH manually in Windows 8 or later. 我不知道它是否与其他操作系统完全相同,但您不必在Windows 8或更高版本中手动设置PATH。

Java version used : 1.8 IDE : Eclipse Neon 使用的Java版本:1.8 IDE:Eclipse Neon

Adding like the below didn't work for me 像下面这样添加不适合我

-vm [relative java home]/jdk1.8.0_21/bin/javaw.exe -vm [relative java home] /jdk1.8.0_21/bin/javaw.exe

and then when i removed 然后当我删除

javaw.exe javaw.exe的

it worked, so it will be like 它工作,所以它会像

-vm [relative java home]/jdk1.8.0_21/bin/ -vm [relative java home] /jdk1.8.0_21/bin/

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

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