简体   繁体   English

eclipse 无法启动 - 没有找到 java 虚拟机

[英]eclipse won't start - no java virtual machine was found

Eclipse was running fine yesterday (and has been since I installed it about a year ago). Eclipse 昨天运行良好(自从我大约一年前安装它以来一直运行良好)。 Now all the sudden I'm getting the following error on startup:现在突然间我在启动时收到以下错误:

"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:\Program Files\eclipse\jre\bin\javaw.exe
javaw.exe in your current PATH"

I have not changed anyhing Eclipse/Java related on my machine but a Windows update was applied to my machine yesterday, so maybe that has something to do with it (but I don't see anything that would affect Java).我没有在我的机器上更改任何与 Eclipse/Java 相关的内容,但是昨天我的机器上应用了 Windows 更新,所以也许这与它有关(但我没有看到任何会影响 Java 的东西)。 I've looked at all the other posts about adding something to your PATH or adding the -vm option to the Eclipse ini (couldn't get this to work) or copying the jre folder to eclipse\jre (this worked but doesn't seem like a good long term solution).我查看了所有其他关于在 PATH 中添加内容或将 -vm 选项添加到 Eclipse ini(无法使其正常工作)或将 jre 文件夹复制到 eclipse\jre(这工作但没有似乎是一个很好的长期解决方案)。 So I'm really trying to figure out how to get things back to the "default" setup without messing stuff up.所以我真的想弄清楚如何让事情回到“默认”设置而不会搞砸。

I'm running Windows 7, Eclipse Helios and Java 1.6.0_26.我正在运行Windows 7, Eclipse Helios and Java 1.6.0_26.

Two ways to work around this .解决此问题的两种方法。

Note : Eclipse DOES NOT consult the JAVA_HOME environment variable.注意:Eclipse 不参考 JAVA_HOME 环境变量。

确保 Java 版本和 Eclipse 都属于同一架构。所以为 64 位 eclipse 安装 64 位 java。

eclipse.ini:日食.ini:

--launcher.defaultAction  
--launcher.XXMaxPermSize  
256M  
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize<br/>
256m  
--launcher.defaultAction  
openFile  
-showsplash  
org.eclipse.platform
-vm
C:\Program Files\Java\jdk1.7.0_21\jre\bin\server\jvm.dll<br/>
--launcher.XXMaxPermSize  
256m  
--launcher.defaultAction  
openFile  
-vmargs  
-Dosgi.requiredJavaVersion=1.7  

That worked for me.这对我有用。 It doesnt have to be on the beginning, but surely it cant be at the end of the file.它不必在开头,但肯定不能在文件末尾。

In my case i had few things missing.就我而言,我缺少一些东西。 I didnt install JDK and JRE of 64 bit while eclipse was of 64 bit version.我没有安装 64 位的 JDK 和 JRE,而 Eclipse 是 64 位版本。 Once done and JDK\bin path was set in PATH variable eclipse worked fine :)一旦完成并在 PATH 变量中设置了 JDK\bin 路径,eclipse 工作正常:)

Open eclipse.ini file besides eclipse.exe除了eclipse.exe打开eclipse.ini文件

paste粘贴

-vm
C:\Program Files\Java\jdk1.7.0_21\jre\bin\server\jvm.dll 
 //find it if you are having another JDK version.

on first line.在第一行。 And you are good to go.你很高兴。

I had same problem after updating java.更新java后我遇到了同样的问题。 Then I paste然后我粘贴

-vm
C:\Program Files\Java\jre6\bin\javaw.exe

to show the path of javaw.exe in eclipse.ini file.eclipse.ini文件中显示javaw.exe的路径。

Hope this will help you.希望这会帮助你。

I had the same problem.我有同样的问题。 I my case it was a program i've install that had destroyed the PATH env variable.我的情况是我安装的一个程序破坏了 PATH 环境变量。

so check your PATH environment variable.所以检查你的 PATH 环境变量。

After setting Java Path, if you are not able to open your eclipse do below steps:设置 Java 路径后,如果您无法打开 Eclipse,请执行以下步骤:

  1. Go to your Eclipse Folder where you have extracted your eclipse.转到您提取 Eclipse 的 Eclipse 文件夹。

在此处输入图像描述

  1. Open Eclipse file in notepad (by default it will open on notepad)在记事本中打开 Eclipse 文件(默认会在记事本上打开)

Enter two lines输入两行

-vm
C:/Program Files/Java/jdk-11.0.2/bin/javaw.exe

jdk-11.0.2 ,It should be your Java Version, which you will get by the above location. jdk-11.0.2,应该是你的Java版本,通过上面的位置可以得到。

在此处输入图像描述

First第一的

check if you have both java 32 and 64 bit install then检查您是否同时安装了 java 32 和 64 位

Setting Path on Windows在 Windows 上设置路径

Windows 8视窗 8

Drag the Mouse pointer to the Right bottom corner of the screen将鼠标指针拖到屏幕的右下角

Click on the Search icon and type: Control Panel单击搜索图标并输入:控制面板

Click on -> Control Panel -> System -> Advanced点击 -> 控制面板 -> 系统 -> 高级

Click on Environment Variables, under System Variables, find PATH, and click on it.单击环境变量,在系统变量下,找到 PATH,然后单击它。

In the Edit windows, modify PATH by adding the location of the class to the value for PATH, Or simply make sure that the variable name is in ALL CAPS在“编辑”窗口中,通过将类的位置添加到 PATH 的值来修改 PATH,或者只是确保变量名称全部大写

If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.如果您没有 PATH 项,您可以选择添加新变量并添加 PATH 作为名称和类的位置作为值。

Close the window.关闭窗口。

Reopen Command prompt window, and run your java code.重新打开命令提示符窗口,然后运行您的 java 代码。

Via Puppet ATG installation Centos.通过 Puppet ATG 安装 Centos。

ERROR:错误:

No Java virtual machine could be found from your PATH无法从您的 PATH 中找到 Java 虚拟机

SOLUTION:解决方案:

Declear variable :清除变量

$java_home="/opt/oracle/product/java/jdk1.8.0_45/bin" $java_home="/opt/oracle/product/java/jdk1.8.0_45/bin"

Add This "{$java_home}" Java Exec添加这个“{$java_home}” Java Exec

require common, java
Exec {
    path => [ "${java_home}", "/usr/bin", "/bin", "/usr/sbin", "${temp_directory}"]
}

On Centos 7 I fixed this problem (after a big yum upgrade ) by changing my setting for vm in:Centos 7上,我通过更改vm in 的设置来解决这个问题(在yum upgrade之后):

~/eclipse/java-oxygen/eclipse/eclipse.ini

to:至:

-vm
/etc/alternatives/jre/bin

(which will always point to the latest installed java ) (它总是指向最新安装的java

尝试下载并安装 32 位版本的 Java,然后设置路径 :)

Yeah it happend to me right now.是的,它现在发生在我身上。 Go to Oracle site, and search for Java SDK.转到 Oracle 站点,然后搜索 Java SDK。 Make sure you use the same architeture (x86, x64) of Eclipse.确保使用与 Eclipse 相同的架构(x86、x64)。

This happened to me also.这也发生在我身上。 And I found the javaw.exe in C:\Windows\System32 got deleted after the windows update.我发现 C:\Windows\System32 中的 javaw.exe 在 Windows 更新后被删除了。 Copied one more time and Eclipse started all fine.再复制一次,Eclipse 开始一切正常。

Chek os、eclipse 和 java 是 32 位还是 64 位

您还可以将您的 JRE 文件夹复制到 eclipse 目录,它可以正常工作

The problem occurred on my machine due to Java version got updated(66 from 60).由于更新了 Java 版本(从 60 到 66),我的机器上出现了问题。 Pay special attention to it.要特别注意它。 As said above would like to add如上所述想补充

In this file eclipse.ini , which is available where you have installed eclipse search for the line below -vm example C:\Program Files\Java\jre1.8.0_ 66 \bin在这个文件eclipse.ini中,你可以在安装 eclipse 的地方找到-vm example C:\Program Files\Java\jre1.8.0_ 66 \bin

now try to open this location, in case you are not able to open, that means there is some problem.现在尝试打开这个位置,万一打不开,说明有问题。 In my case the version installed was jre1.8.0_ 60 .在我的情况下,安装的版本是 jre1.8.0_ 60 So there was a small difference which may not noticeable(66 instead of 60).所以有一个可能不明显的小差异(66而不是60)。 Update it you will be able to open.更新一下就可以打开了。

I came across same issue y'day, with PATH etc configured correctly.我今天遇到了同样的问题,正确配置了 PATH 等。 It can be opened from command line, just now working by a double click.它可以从命令行打开,现在只需双击即可。

And it was working now, by just " Run as administrator " :)现在它正在工作,只需“以管理员身份运行”:)

Some time this happens when your Java folder get updated.有时当您的 Java 文件夹更新时会发生这种情况。

Open Eclipse folder and search file eclipse.ini.打开 Eclipse 文件夹并搜索文件 eclipse.ini。 Open the eclipse.ini file and check whether jre version is same as jre available in your java folder.打开 eclipse.ini 文件并检查 jre 版本是否与您的 java 文件夹中可用的 jre 相同。

I faced same problem when my jre got changed from jre1.8.0_101 to jre1.8.0_111.当我的 jre 从 jre1.8.0_101 更改为 jre1.8.0_111 时,我遇到了同样的问题。

C:\Program Files\Java\jre1.8.0_101\bin to C:\Program Files\Java\jre1.8.0_111\bin C:\Program Files\Java\jre1.8.0_101\bin 到 C:\Program Files\Java\jre1.8.0_111\bin

In my case the problem was that the path was enclosed in quotation marks ("):就我而言,问题是路径用引号(“)括起来:

-vm 
"C:\Program Files\Java\jdk1.8.0_25\bin"

Removing them fixed the problem:删除它们解决了问题:

-vm 
C:\Program Files\Java\jdk1.8.0_25\bin

My solution is Include JDK's "bin" Directory in the PATH我的解决方案是在 PATH 中包含 JDK 的“bin”目录

To edit the PATH environment variable in Windows 7/8/10:Windows 7/8/10:中编辑PATH环境变量:

  1. Launch "Control Panel" ⇒ (Optional) System and Security ⇒ System ⇒ Click "Advanced system settings" on the left pane.启动“控制面板”⇒(可选)系统和安全⇒系统⇒单击左侧窗格中的“高级系统设置”。
  2. Switch to "Advanced" tab ⇒ Push "Environment Variables" button.切换到“高级”选项卡⇒按下“环境变量”按钮。 Under "System Variables" (the bottom pane), scroll down to select "Path" ⇒ Click "Edit...".在“系统变量”(底部窗格)下,向下滚动以选择“路径”⇒单击“编辑...”。
  3. Copy the JDK bin directory from JAVA folder and paste to "Edit..."从 JAVA 文件夹复制 JDK bin 目录并粘贴到“编辑...”

you should change the jdk path in eclipse.ini here:您应该在这里更改 eclipse.ini 中的 jdk 路径:

/Users/you_username/eclipse/jee-photon/Eclipse.app/Contents/Eclipse/eclipse.ini /Users/you_username/eclipse/jee-photon/Eclipse.app/Contents/Eclipse/eclipse.ini

after you should restart eclipse :)在你应该重新启动 Eclipse 之后:)

If Eclipse isn't finding your JRE/JDK or finding the wrong version, add the following two lines to the beginning of your eclipse.ini file:如果 Eclipse 没有找到您的 JRE/JDK 或找到错误的版本,请将以下两行添加到eclipse.ini文件的开头:

-vm
[your-path-to-java-executable]

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

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