Java 使用 JRE 路径设置 Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16394822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-16 06:40:48  来源:igfitidea点击:

Setting up Eclipse with JRE Path

javaeclipsepathenvironment

提问by user2351151

I have downloaded and extracted Eclipse. I have Eclipse in the following directory: C:\Applications\eclipse. When I try and run the executable , I get the following message :

我已经下载并解压了 Eclipse。我在以下目录中有 Eclipse:C:\Applications\eclipse. 当我尝试运行可执行文件时,我收到以下消息:

NO JRE in System PATH

系统路径中没有 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 ? If so , may I please have some help to do this ? If not , can I please have some help to get Eclipse to run .

我是否需要为我的 Windows 7 操作系统设置一些环境变量才能运行 Eclipse?如果是这样,我可以帮忙吗?如果没有,我可以请一些帮助来运行 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

回答by Dariusz

You are most probably missing PATH entries in your windows. Follow this instruction : How do I set or change the PATH system variable?

您很可能在 Windows 中缺少 PATH 条目。请遵循以下说明:如何设置或更改 PATH 系统变量?

回答by Aubin

I have several version of JDK (not JRE) instaled and I launch Eclipse with:

我安装了多个版本的 JDK(不是 JRE),然后我使用以下命令启动 Eclipse:

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

As you can see, I set JAVA_HOMEto point to the version of JDK I want to use.

如您所见,我设置JAVA_HOME为指向我想要使用的 JDK 版本。

I NEVER add javaw.exe in the PATH.

我从不在 PATH 中添加 javaw.exe。

-datais used to choose a workspace for a particular job/client/context.

-data用于为特定作业/客户端/上下文选择工作区。

回答by Evgeniy Dorofeev

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_HOMEand JRE_HOMEanyway 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 等。

回答by Noname

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

回答by Joshua Michael Waggoner

This may sound dumb, but it may be a fresh, or damaged install, so is the JDK installed? If not, go to the download site and download the latest version of Java JRE. Like I said, this may sound dumb, but it solved my problem.

这听起来可能很愚蠢,但它可能是全新安装或损坏的安装,那么是否安装了 JDK?如果没有,请转到下载站点并下载最新版本的 Java JRE。就像我说的,这听起来很愚蠢,但它解决了我的问题。

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

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

回答by NBApps

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 应用程序在运行,所以它不会影响我)

回答by pluto

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 之前添加这些行

回答by user137717

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.
  2. Then download and install eclipse.
  1. 下载并安装带有所有默认设置和选项的 jdk 或 jre。
  2. 然后下载并安装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。

回答by Maximo_Sufferer

I had the same issue caused by two things:

我遇到了由两件事引起的同样问题:

  1. I had downloaded a 32bit Java version instead of 64bit.
  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.
  1. 我下载了 32 位 Java 版本而不是 64 位。
  2. eclipse.ini 没有 javaw.exe 的路径,因此根据之前的帖子添加了指向 java.exe 位置的语句。

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,安装了正确的 Java 并添加了 javaw.exe 路径后,eclipse 启动了,没有更多错误

回答by EL missaoui habib

Add the following -vm D:/Java/jdk1.6.0_30/bin/javaw.exein 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