简体   繁体   English

在 Eclipse 中更改 JDK 路径

[英]Change JDK Path in eclipse

The title is everything I have.标题是我拥有的一切。 I tried two answers from previous users, but they didn't help me.我尝试以前用户的两个答案,但他们没有帮助我。 Maybe I am too bad for this but I just can't get it working.也许我对此太糟糕了,但我无法让它发挥作用。

I'm currently trying my hands on modding Minecraft, and so I set up my workspace.我目前正在尝试修改 Minecraft,因此我设置了我的工作区。 Everything is fine but then I wanted to run it.一切都很好,但后来我想运行它。

When running this is one of the Errors : Could not find tools.jar.运行时这是错误之一:找不到tools.jar。 Please check that C:\\Program Files\\Java\\jre1.8.0_261 contains a valid JDK installation.请检查 C:\\Program Files\\Java\\jre1.8.0_261 是否包含有效的 JDK 安装。

Thanks for everyone who will take their time and help me.感谢所有愿意花时间帮助我的人。

Edit: I will post screenshots of the things I forgot to post.编辑:我将发布我忘记发布的内容的屏幕截图。

Java location爪哇位置

jdk 1.8.0 contents jdk 1.8.0 内容

jdk 12.0.1 contents jdk 12.0.1 内容

jre 1.8.0 contents jre 1.8.0 内容

.gradle Folder contents .gradle 文件夹内容

Edit 2:编辑2:

After a new answer, I got a new problem.在一个新的答案之后,我遇到了一个新问题。

This one seems quite different because its now saying: "Execution failed for task ':compileJava'."这个看起来完全不同,因为它现在说:“任务':compileJava'的执行失败。”

Second Error in Eclipse Eclipse 中的第二个错误

Second Error in Eclipse 2 Eclipse 2 中的第二个错误

Second Error in Eclipse 3 Eclipse 3 中的第二个错误

您可以尝试右键单击您的项目名称,然后转到 Build Path -> Preferences -> Configure Build Path ... 然后在“Libraries”选项卡中,单击 JRE,单击编辑并为该特定项目选择一个.

Your error message says, that you are using JRE instead of JDK and that seems to be your problem.您的错误消息说,您使用的是 JRE 而不是 JDK,这似乎是您的问题。 You can change or check this in Eclipse Perferences.您可以在 Eclipse Perferences 中更改或检查它。
In the menu bar click the following menu items: Window => Preferences在菜单栏中单击以下菜单项:Window => Preferences
In the following Preferences window navigate like this: Java => Installed JREs在以下首选项窗口中导航如下:Java => Installed JREs

There you will see all JREs and JDKs, which eclipse knows.在那里您将看到 eclipse 知道的所有 JRE 和 JDK。
Make sure that the list contains jdk-12 or jdk-8 by clicking the "Add..." button.单击“添加...”按钮,确保列表包含 jdk-12 或 jdk-8。
Select in this window the newly added JDK and click "Apply & Close".在此窗口中选择新添加的 JDK,然后单击“应用并关闭”。
Then it should work.那么它应该工作。

In my German blog, I have a post about how I setup and configure my Eclipse: https://agile-coding.blogspot.com/2020/09/eclipse-als-ide-fur-java-spring.html在我的德语博客中,我有一篇关于如何设置和配置 Eclipse 的帖子: https : //agile-coding.blogspot.com/2020/09/eclipse-als-ide-fur-java-spring.html

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

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