简体   繁体   English

Eclipse-找不到JDK

[英]Eclipse- JDK not found

I have downloaded JDK 7 and Eclipse Helios, but when I open Eclipse, I get the following error我已经下载了 JDK 7 和 Eclipse Helios,但是当我打开 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:\eclipse\jre\javaw.exe javaw.exe in your current PATH

I have tried to put the exact path of JDK bin folder in eclipse.ini file but it didn't work我试图将 JDK bin 文件夹的确切路径放在 eclipse.ini 文件中,但没有用

-vm
C:\Program Files\Java\jdk1.7.0_05\bin

Can somebody tell me what is the reason behind this issue and how can I solve it.有人可以告诉我这个问题背后的原因是什么,我该如何解决。

When I had this problem, I solved the following way (I have Windows 7):当我遇到这个问题时,我通过以下方式解决了(我有 Windows 7):

  1. Right click on the Eclipse icon in your desktop.右键单击桌面上的 Eclipse 图标。
  2. Properties特性
  3. Target: C:\\eclipse\\eclipse.exe -vm C:\\Java\\jdk1.6.0_32\\jre\\bin\\javaw.exe目标:C:\\eclipse\\eclipse.exe -vm C:\\Java\\jdk1.6.0_32\\jre\\bin\\javaw.exe

    3a (if your jdk is installed in a path like "Program Files"): C:\\eclipse\\eclipse.exe -vm "C:\\Java\\jdk1.6.0_32\\jre\\bin\\javaw.exe" 3a(如果您的 jdk 安装在类似“Program Files”的路径中):C:\\eclipse\\eclipse.exe -vm "C:\\Java\\jdk1.6.0_32\\jre\\bin\\javaw.exe"

In your eclipse.ini file you need to specify the path to the Jave executable, not just the bin directory, as described in the Eclipse wiki .eclipse.ini文件中,您需要指定 Java 可执行文件的路径,而不仅仅是bin目录,如Eclipse wiki 中所述 For example, like this:例如,像这样:

-vm
C:\Program Files\Java\jdk1.7.0_05\bin\javaw.exe

设置环境变量Path

Path=C:\Program Files\Java\jdk1.7.0_05\bin

可能是因为您还没有下载 Oracle... 我遇到了同样的问题。

I think that eclipse needs to read the file Java, but it does not know where it is located.我认为eclipse需要读取文件Java,但它不知道它在哪里。 I normally specify the PATH variable when I install a Java SDK.我通常在安装 Java SDK 时指定 PATH 变量。 I think you need to to this, too since it complains about "your current PATH".我认为您也需要这样做,因为它抱怨“您当前的路径”。

Oracle tells you how to do this: Oracle 告诉您如何执行此操作:

http://docs.oracle.com/javase/tutorial/essential/environment/paths.html http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Windows 7 Windows 7的

From the desktop, right click the Computer icon.在桌面上,右键单击计算机图标。 Choose Properties from the context menu.从上下文菜单中选择属性。 Click the Advanced system settings link.单击高级系统设置链接。 Click Environment Variables.单击环境变量。 In the section System Variables, find the PATH environment variable and select it.在 System Variables 部分,找到 PATH 环境变量并选择它。 Click Edit.单击编辑。 If the PATH environment variable does not exist, click New.如果 PATH 环境变量不存在,请单击新建。 In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable.在 Edit System Variable(或 New System Variable)窗口中,指定 PATH 环境变量的值。 Click OK.单击确定。 Close all remaining windows by clicking OK.单击确定关闭所有剩余的窗口。

C:\\Program Files\\Java C:\\程序文件\\Java

I ran into the same problem today after installing eclipse on a new PC with an up-to-date 64-bit JRE (on Windows 7 x64).在使用最新的 64 位 JRE(在 Windows 7 x64 上)的新 PC 上安装 eclipse 后,我今天遇到了同样的问题。 Ajusting the PATH Variable as suggested resulted in the JNI file not found error.按照建议调整 PATH 变量导致未找到 JNI 文件错误。

The problem was that I was using a 32-bit eclipse with a 64-bit java runtime.问题是我使用的是带有 64 位 java 运行时的 32 位 eclipse。 On another computer there was an old 32-bit JRE installed, so the 32-bit eclipse was working.在另一台计算机上安装了旧的 32 位 JRE,因此 32 位 eclipse 可以正常工作。 After uninstalling the 32-bit JRE, eclipse stopped working with the same error as above.卸载 32 位 JRE 后,eclipse 停止工作,并出现与上述相同的错误。

What I learned from this:我从中学到了什么:

  • Even though java is cross platform, there still is a difference between 32 and 64 bit versions即使java是跨平台的,32位和64位版本还是有区别的
  • Java JRE and the eclipse version have to match (32 or 64 bit) to run properly Java JRE 和 eclipse 版本必须匹配(32 或 64 位)才能正常运行
  • Consequently, it might be necessary to install both - the 32 and 64 bit JRE, depending on the software used因此,可能需要同时安装 32 位和 64 位 JRE,具体取决于所使用的软件
  • When updating Java, one always has to update both versions of JRE更新 Java 时,必须同时更新两个版本的 JRE
  • Adding the JRE folder to the PATH is not necessary, it doesn't fix the problem不需要将 JRE 文件夹添加到 PATH,它不能解决问题

Yeah, Even i faced the same problem and found out a solution.是的,即使我遇到了同样的问题并找到了解决方案。 First check whether you have installed Java Jdk .首先检查你是否安装了 Java Jdk 。 If yes then proceed.... Then go to C:\\ then Program Files and look for java and in there you will find a Jdk file open it then copy the bin file and go to your adt-bundle-windows-x86_64 and place the bin file under Eclipse .如果是,则继续...。然后转到 C:\\ 然后是 Program Files 并查找 java,在那里你会发现一个 Jdk 文件打开它然后复制 bin 文件并转到你的 adt-bundle-windows-x86_64 并放置Eclipse 下的 bin 文件。 Hope this works for you and happy developing ;)希望这对你有用并且开发愉快;)

Because Eclipse and JDK "installing time" is very short.因为Eclipse和JDK的“安装时间”很短。 I think a clean solution will save your time.我认为一个干净的解决方案会节省你的时间。

1/ The first, JDK and Eclipse should be the same "bit" (Eclipse 32 bit go with JDK 32bit, and 64 bit so on). I think nowaday computers with large memory and modern 64 bit OS should choose the 64 bit pair.
2/ Remove all JDK version in your PC, check if its done by: Open CMD, type "java" and enter, if there is no application run, you done.
3/ Install JDK (assume JDK 8 64 bit)
4/ Download the rights version of Eclipse (zip)(assumse you download 64 bit version)
5/ Just extract eclipse and run it.

Eclipse is just a portable software which packaged in a zip, don't waste your time to fix a wrong installation. Eclipse 只是一个打包在 zip 中的便携式软件,不要浪费时间来修复错误的安装。 Hope this help.希望这有帮助。

E-Riz's comment worked for me, I just had to make sure I put the command at the top of the ini file. E-Riz 的评论对我有用,我只需要确保将命令放在 ini 文件的顶部。

Inside the eclipse directory you will have an eclipse.ini, at the very top of the ini file past the directory path在 eclipse 目录中,您将有一个 eclipse.ini,位于目录路径之后的 ini 文件的最顶部

-vm
C:\.....\Java\jdk1.7.0_05\bin\javaw.exe

You don't need to edit any path.您不需要编辑任何路径。 Here is what you do.这就是你要做的。

  1. Open the Eclipse folder打开 Eclipse 文件夹
  2. Search "javaw" in the search.在搜索中搜索“javaw”。
  3. Copy "javaw" and paste it into the folder.复制“javaw”并将其粘贴到文件夹中。
  4. Open Eclipse.打开日食。
  5. Enjoy!享受!

I don't know why you guys keep talking about the path.我不知道你们为什么一直在谈论路径。 It has nothing to do with it.它与它无关。 The dialogue box said is was only searching that folder for the javaw program.对话框说只是在该文件夹中搜索 javaw 程序。

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

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