Java 由于环境变量,Eclipse 无法打开

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2162121/
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-13 04:15:48  来源:igfitidea点击:

Eclipse will not open due to environment variables

javaeclipseenvironment-variables

提问by Gandalf StormCrow

I just rebooted my computer without changing anything. Suddenly I can't open Eclipse. Instead, I get this error message:

我只是重新启动了我的电脑,没有改变任何东西。突然我无法打开Eclipse。相反,我收到此错误消息:

┌──────────────────────────────────────────────────────────────────────┐
│ Eclipse                                                              │
├──────────────────────────────────────────────────────────────────────┤
│                                                                      │
│   A Java Runtime Environment (JRE) or Java Development Kit (JDK)     │
│   must be available in order to run Eclipse. No Java virtual machine │
│   was found after searching the following locations:                 │
│   C:\Users\emiri\Downloads\eclipse\jre\bin\javaw.exe                 │
│   javaw.exe in your current PATH                                     │
│                                                                      │
│                                                      ┌────────────┐  │
│                                                      │     OK     │  │
│                                                      └────────────┘  │
└──────────────────────────────────────────────────────────────────────┘

And I see all my environment variables have been erased. java, javac, mvn, etc. don't work. What do I do now, and how do I fix this?

我看到我所有的环境变量都被删除了。javajavacmvn等不起作用。我现在该怎么办,我该如何解决这个问题?

采纳答案by Gandalf StormCrow

Here is the answer, sorry .. but your solutions weren't correct

这是答案,抱歉……但您的解决方案不正确

set PATH=C:\Program Files\Java\jre1.6.0_03\bin ;%PATH%

paxdiabloDid you rewrite the error or you got some kind of software reading text from image, if you got which one ?

paxdiablo您是否重写了错误,或者您是否有某种软件从图像中读取文本,如果您得到的是哪一个?

回答by St.Shadow

Let eclipse use your java vm directly!

让 eclipse 直接使用你的 java vm!

Put these lines at the end of eclipse.ini (located in the directory where eclipse.exe is present):

将这些行放在 eclipse.ini 的末尾(位于 eclipse.exe 所在的目录中):

-vm
<your path to jdk|jre>/bin/javaw.exe

Pay attention that there are twolines. Also make sure that the -vm option is before the -vmargs option (and of course after "openFile").

注意有两条线。还要确保 -vm 选项在 -vmargs 选项之前(当然在“openFile”之后)。

Useful link Eclispe.ini at wiki.eclipse.org

wiki.eclipse.org 上的有用链接Eclispe.ini

回答by Phil Hayward

Another alternative is to re-run the JRE setup. It typically installs a default JRE by placing java.exe, javaw.exe, etc. in your system folder. That would place the executables in your path, which should be sufficient, based on the note in the error message that it searched your path for javaw.exe

另一种选择是重新运行 JRE 设置。它通常通过将 java.exe、javaw.exe 等放在您的系统文件夹中来安装默认 JRE。这会将可执行文件放在您的路径中,这应该足够了,根据错误消息中的注释,它在您的路径中搜索 javaw.exe

回答by Chuck

I think I found an easier way (for me anyway). Locate your javaw.exefile (either by searching for it or just where you installed it), then drag the javaw.exefile onto the eclipse.exefile and it will use it.

我想我找到了一种更简单的方法(无论如何对我来说)。找到您的javaw.exe文件(通过搜索它或只是您安装它的位置),然后将javaw.exe文件拖到eclipse.exe文件上,它将使用它。

回答by Nasirali

First uninstall all java software like JRE 7 or JRE 6 or JDK ,then open the following path :

首先卸载JRE 7或JRE 6或JDK等所有java软件,然后打开以下路径:

START > CONTROL PANEL > ADVANCED SETTING > ENVIRONMENT VARIABLE > SYSTEM VARIABLE > PATH

开始 > 控制面板 > 高级设置 > 环境变量 > 系统变量 > 路径

Then click on Edit button and paste the following text to Variable_Value and click OK.

然后单击编辑按钮并将以下文本粘贴到 Variable_Value 并单击确定。

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem ;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared \;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86) \Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\

Now go to this url http://java.com/en/download/manual.jspand click on Windows Offlineand click on run and start again eclipse.

现在转到此 URL http://java.com/en/download/manual.jsp并单击Windows Offline并单击运行并再次启动 eclipse。

Enjoy it!

好好享受!

回答by binh

very easy, you just copy the folder 'jre' to the folder that you put eclipse. That'all. Jre is the environment, normally it's location in the C:/Programing Files/Java/jre :D

非常简单,您只需将文件夹“jre”复制到您放置 eclipse 的文件夹中。就是这样。Jre 是环境,通常它位于 C:/Programing Files/Java/jre 中:D

回答by Pir Fahim Shah

Ok...Ok... Don't worry i am also ruined by this error and fatal and when i got it i was so serious even i was not giving an attention to other work, but i got it, Simply first of all copy this code and paste in your system variable Under path ...

好吧……好吧……别担心我也被这个错误和致命的错误毁了,当我得到它时,我很认真,即使我没有关注其他工作,但我明白了,首先复制此代码并粘贴到您的系统变量下路径...

C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\Program Files\Java\jre6\bin\javaw.exe

C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\Program Files\Java\jre6\bin\javaw.exe

Now copy the "jre" folderfrom your path like i have have "jre" under this path

现在从你的路径复制“jre”文件夹,就像我在这个路径下有“jre”一样

            C:\Program Files\Java

and paste it in your eclipse folder means where your eclipse.exe file is placed. like i have my eclipse set up in this location

并将其粘贴到您的 eclipse 文件夹中意味着您的 eclipse.exe 文件所在的位置。就像我在这个位置设置了我的日食

    F:\Softwares\LANGUAGES SOFTEARE\Android Setup\eclipse

So inside the eclipse Folder paste the "jre" FOLDER . If you have "jre6" then rename it as "jre"....and run your eclipse you will got the solution...

所以在 eclipse Folder 里面粘贴“jre” FOLDER 。如果您有“jre6”,则将其重命名为“jre”……然后运行您的日食,您将获得解决方案……

   //<<<<<<<<<<<<<<----------------------------->>>>>>>>>>>>>>>>>>>                 

OTHER SOLUTION: 2

其他解决方案:2

If the problem could't solve with the above steps, then follow these steps

如果上述步骤无法解决问题,请按照以下步骤操作

  1. Copy the folder "jre" from your Java path like C:\Program Files\Java\jre6* etc, and paste it in your eclipse directory(Where is your eclipse available)
  2. Go to eclipse.ini file , open it up.
  3. Change the directory of your javaw.exe file like
  1. 从您的 Java 路径中复制文件夹“jre”,例如 C:\Program Files\Java\jre6* 等,并将其粘贴到您的 eclipse 目录中(您的 eclipse 在哪里可用)
  2. 转到 eclipse.ini 文件,打开它。
  3. 更改 javaw.exe 文件的目录,例如

-vmF:\Softwares\LANGUAGES SOFTEARE\Android Setup\eclipse Indigo version 32 Bit\jre\bin/javaw.exe

-vmF:\Softwares\LANGUAGES SOFTEARE\Android Setup\eclipse Indigo version 32 Bit\jre\bin/javaw.exe

Now this time when you will start eclipse it will search for javaw.exe, so it will search the path in the eclipse.ini, as it is now in the same folder so, it will start the javaw.exe and it will start working.

现在,当您启动 eclipse 时,它​​将搜索 javaw.exe,因此它将搜索 eclipse.ini 中的路径,因为它现在位于同一文件夹中,因此,它将启动 javaw.exe 并开始工作.

If You still have any query you can ask it again, just go on my profile and find out my email id. because i love stack overflow forum, and it made me a programmer.*

如果您仍有任何疑问,可以再次提问,只需访问我的个人资料并找出我的电子邮件 ID。因为我喜欢堆栈溢出论坛,这让我成为了一名程序员。*

回答by IWIH

You should install both 32bit & 64bit java (At least JRE), that in case you're using 64bit OS.

您应该同时安装 32 位和 64 位 java(至少是 JRE),以防您使用 64 位操作系统。

回答by MeJ

Eclipse and Java JDK (or JRE) must match regarding the BIT Version

Eclipse 和 Java JDK(或 JRE)在 BIT 版本方面必须匹配

For example:

例如:

32 Bit Eclipse won't work with 64 Bit Java!

32 Bit Eclipse needs 32 Bit Java!

32 位 Eclipse 需要 32 位 Java!

回答by user3068564

-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.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
**-vm
C:/Program Files (x86)/Java/jdk1.7.0_45/bin/javaw.exe** =>false
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m
-vm
C:\Program Files (x86)\Java\jdk1.7.0_45\bin\javaw.exe