简体   繁体   English

为什么Eclipse将/ jre添加到我的JAVA_HOME

[英]Why is Eclipse adding /jre to my JAVA_HOME

A colleague installed a new application for me today and has managed to mangle my PATH and my java environments. 一位同事今天为我安装了一个新应用程序,并设法处理了我的PATH和Java环境。 I think I have the critical stuff back, but java build in Eclipse (via ant) does not work. 我认为我有一些重要的东西,但是在Eclipse中(通过ant)的Java构建无法正常工作。 I get the following error: 我收到以下错误:

Unable to find a javac compiler; 找不到javac编译器; com.sun.tools.javac.Main is not on the classpath. com.sun.tools.javac.Main不在类路径中。 Perhaps JAVA_HOME does not point to the JDK. 也许JAVA_HOME没有指向JDK。 It is currently set to "C:\\Java\\jdk\\jre" 当前设置为“ C:\\ Java \\ jdk \\ jre”

The really weird thing is that that is not what my JAV_HOME is set to! 真正奇怪的是那不是我的JAV_HOME设置的!

H:\>echo %JAVA_HOME%
C:\Java\jdk

Where is the extra \\jre coming from? 多余的\\jre来自哪里?

I have also added C:\\Java\\jdk\\bin to my PATH variable, so javac is on the path: 我还添加了C:\\Java\\jdk\\bin到我的PATH变量,所以javac 路径:

H:\>javac
Usage: javac <options> <source files>
where possible options include:

The line in the build.xml which the stack trace points to is a simple javac ant command: 堆栈跟踪指向的build.xml中的行是一个简单的javac ant命令:

<javac source="${webapps.javac_target}" target="${webapps.javac_target}" debug="on" destdir="${classes}" srcdir="${src}">

The default Installed JRE has location C:\\Java\\jdk (and this is the one used by this project). 默认的已安装JRE的位置为C:\\Java\\jdk (这是此项目使用的位置)。 Even the eclipse.ini ensures that Eclipse uses the same JDK with 甚至eclipse.ini都确保Eclipse将相同的JDK与

-vm
C:\Java\jdk\bin\javaw.exe

Any ideas what I need to set to make this work again? 我需要设定什么想法才能再次进行这项工作?

I thought that the Installed JREs was correct. 认为已安装的JRE是正确的。 I even downloaded a new JDK. 我什至下载了一个新的JDK。 In the end we discovered that it was pointing to the JDK root, not the JRE folder within. 最后,我们发现它指向的是JDK根目录,而不是其中的JRE文件夹。 Changing that solved my problem 改变解决了我的问题

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

相关问题 为什么我的JAVA_HOME指向jre而不是jdk? - Why does my JAVA_HOME point to jre instead of jdk? Maven eclipse插件使用Eclipse JRE而不是JAVA_HOME - Maven eclipse plugin uses Eclipse JRE instead of JAVA_HOME 我的tomcat使用了错误的JAVA_HOME或JRE_HOME - my tomcat uses wrong JAVA_HOME or JRE_HOME 将Java DLL放在JAVA_HOME \\ jre6 \\ bin中却无法使用java.library.path时,为什么我的Java项目可以在Eclipse中成功调用DLL? - Why can my Java project call my DLLs successfully in Eclipse when I place them in JAVA_HOME\jre6\bin but failed in using java.library.path? 您如何将Eclipse和Eclipse项目指向eclipse中的新JRE版本? (不使用JAVA_HOME) - How do you point your Eclipse and Eclipse projects to a new JRE version in eclipse? (Not using JAVA_HOME) 为什么 maven 忽略我的 JAVA_HOME? - Why maven ignores my JAVA_HOME? JAVA_HOME 应该指向 JDK 而不是 JRE - JAVA_HOME should point to a JDK not a JRE JAVA_HOME 应该指向 JDK 还是 JRE? - Should JAVA_HOME point to JDK or JRE? 为什么不能将JAVA_HOME和JRE_HOME设置为其他内容? - Why can't I set JAVA_HOME and JRE_HOME to something else? 指向 Eclipse IDE 以使用 JAVA_HOME 中指定的 JRE/JDK 以外的另一个 JRE/JDK - Point eclipse IDE to use another JRE / JDK other than one specified in JAVA_HOME
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM