简体   繁体   中英

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. Everything is fine but then I wanted to run it.

When running this is one of the Errors : Could not find tools.jar. Please check that C:\\Program Files\\Java\\jre1.8.0_261 contains a valid JDK installation.

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 12.0.1 contents

jre 1.8.0 contents

.gradle Folder contents

Edit 2:

After a new answer, I got a new problem.

This one seems quite different because its now saying: "Execution failed for task ':compileJava'."

Second Error in Eclipse

Second Error in Eclipse 2

Second Error in 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. You can change or check this in Eclipse Perferences.
In the menu bar click the following menu items: Window => Preferences
In the following Preferences window navigate like this: Java => Installed JREs

There you will see all JREs and JDKs, which eclipse knows.
Make sure that the list contains jdk-12 or jdk-8 by clicking the "Add..." button.
Select in this window the newly added JDK and click "Apply & Close".
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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