简体   繁体   English

Eclipse Oxygen - 该项目未构建,因为其构建路径不完整

[英]Eclipse Oxygen - The project was not built since its build path is incomplete

I just installed Eclipse Oxygen and tried to open an existing project into the workbench but I get this error:我刚刚安装了 Eclipse Oxygen 并尝试将现有项目打开到工作台中,但出现此错误:

The project was not built since its build path is incomplete.该项目未构建,因为其构建路径不完整。 Cannot find the class file for java.lang.Object.找不到 java.lang.Object 的 class 文件。 Fix the build path then try building this project修复构建路径,然后尝试构建此项目

I tried right clicking on the project - went to Properties - Java Build Path - Libraries - Add Library - JRE System Library and selected Workbench default JRE (jre1.8.0_60).我尝试右键单击项目 - 转到属性 - Java 构建路径 - 库 - 添加库 - JRE 系统库并选择 Workbench 默认 JRE (jre1.8.0_60)。

I then cleaned and rebuilt the project but it then causes more errors to come up like:然后我清理并重建了项目,但随后会导致出现更多错误,例如:

ActionBar cannot be resolved to a type
Activity cannot be resolved to a variable
AdapterView cannot be resolved to a type
ArrayAdapter cannot be resolved to a type

Are you using Maven?你在使用 Maven 吗? If so,如果是这样的话,

  1. Right-click on the project, Build Path and go to Configure Build Path右键单击项目,构建路径并转到配置构建路径
  2. Click the libraries tab.单击库选项卡。 If Maven dependencies are not in the list, you need to add it.如果 Maven 依赖项不在列表中,则需要添加它。
  3. Close the dialog.关闭对话框。

To add it: Right-click on the project, Maven → Disable Maven Nature Right-click on the project, Configure → Convert to Maven Project.添加它: 右键单击​​项目,Maven → 禁用 Maven Nature 右键单击​​项目,配置 → 转换为 Maven 项目。

And then clean然后清洗

Edit 1:编辑1:

If that doesn't resolve the issue try right-clicking on your project and select properties.如果这不能解决问题,请尝试右键单击您的项目并选择属性。 Select Java Build Path → Library tab.选择 Java 构建路径 → 库选项卡。 Look for a JVM.寻找 JVM。 If it's not there, click to add Library and add the default JVM.如果不存在,请单击添加库并添加默认JVM。 If VM is there, click edit and select the default JVM.如果 VM 存在,请单击编辑并选择默认 JVM。 Hopefully, that works.希望,这有效。

Edit 2:编辑2:

You can also try going into the folder where you have all your projects and delete the .metadata for eclipse (be aware that you'll have to re-import all the projects afterwards! Also all the environment settings you've set would also have to be redone).您也可以尝试进入您拥有所有项目的文件夹并删除 eclipse 的.metadata (请注意,您必须在之后重新导入所有项目!此外,您设置的所有环境设置也将具有要重做)。 After it was deleted just import the project again, and hopefully, it works.删除后只需再次导入项目,希望它可以工作。

Here is what made the error disappear for me:这是使我的错误消失的原因:

Close eclipse, open up a terminal window and run:关闭 eclipse,打开终端窗口并运行:

$ mvn clean eclipse:clean eclipse:eclipse

I'm also using Eclipse Oxygen, migrated from Mars.我也在使用从火星迁移的 Eclipse Oxygen。 I faced the same error.我遇到了同样的错误。 I deleted .metadata , .recommenders folders and added projects from archive and issue is solved.我删除了.metadata.recommenders文件夹并从存档中添加了项目,问题解决了。 I also use Android Studio but i like Eclipse much more.我也使用 Android Studio,但我更喜欢 Eclipse。

At my system the Java Runtime JAR file jrt-fs.jar was not found because it was in the wrong directory.在我的系统中,未找到 Java 运行时 JAR 文件jrt-fs.jar ,因为它位于错误的目录中。 This file should be located in the "lib" subfolder.此文件应位于“lib”子文件夹中。 If you installed Java at "C:\\Temp\\java" the file should be here at C:\\Temp\\java\\lib\\jrt-fs.jar .如果您在“C:\\Temp\\java”安装了 Java,则该文件应该位于 C:\\Temp\\java\\lib\\jrt-fs.jar 。

These are the steps to make jrt-fs.jar available to Eclipse:这些是使jrt-fs.jar可用于 Eclipse 的步骤:

  1. Window / Preferences -> the "Preferences" Window opens窗口/首选项 ->“首选项”窗口打开
  2. Select in the left menu: Java / Installed JREs在左侧菜单中选择:Java / Installed JREs
  3. Press the [Add...] Button -> A window opens按 [添加...] 按钮 -> 一个窗口打开
  4. Select "Standard VM" - The window "JRE Definition" opens.选择“标准 VM” - 窗口“JRE 定义”打开。
  5. Enter your path information:输入您的路径信息:
  6. JRE home = "C:\\Temp\\java" JRE 主页 = "C:\\Temp\\java"
  7. JRE name = "MyJRE" JRE 名称 = "MyJRE"
  8. Select [Add External JARs...] to link the jrt-fs.jar选择[Add External JARs...]链接jrt-fs.jar
  9. JRE system libaries: "C:\\Temp\\java\\lib\\jrt-fs.jar" JRE 系统库:“C:\\Temp\\java\\lib\\jrt-fs.jar”

It worked for me with OpenJDK12 and Eclipse 2019-09 (4.13.0).它适用于 OpenJDK12 和 Eclipse 2019-09 (4.13.0)。 Eclipse reported me this error: Eclipse 向我报告了这个错误:

The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project

I had faced this problem.我曾经遇到过这个问题。 I added the C:\\Users\\Office 2\\android-sdks\\platforms\\android-19\\android.jar to the Java Build Path's Library.我将 C:\\Users\\Office 2\\android-sdks\\platforms\\android-19\\android.jar 添加到 Java Build Path 的库中。 And the project started to run again.然后项目又开始运行了。 The problem occurred due to my carelessness.问题是由于我的粗心造成的。 Yesterday night I was updating the Android SDK, and at the same time I tried to run the project, while the SDK Manager was uncompressing the system image.昨天晚上我正在更新Android SDK,同时我尝试运行该项目,而SDK Manager正在解压缩系统映像。 The Project couldn't start and the error occurred.项目无法启动并发生错误。

I tried all the methods given by others.别人给的方法我都试过了。 But nothing worked.但没有任何效果。 It solved when I added the android.jar to the library.当我将 android.jar 添加到库时它解决了。

I guessed it that android library is missing.我猜是缺少 android 库。 not the Java, when I saw the errors only at the android methods and imports.不是 Java,当我只在 android 方法和导入中看到错误时。 But when I read the posts, I got confused and wasted some time trying wrong way.但是当我阅读这些帖子时,我感到困惑并浪费了一些时间尝试错误的方法。

我遇到了同样的问题并尝试了不同的解决方案,我重新安装了 JDK 11 并重新启动了机器,之后问题得到解决。

I have similar issue when importing Spring Boot, jdk 11 (using inside docker) project to Eclipse 2019 (2021), in Ubuntu, instead when importing to Inteelij IDEA Community or NetBeans IDEs they do not produce the same set of after-import errors as in Eclipse.在 Ubuntu 中将 Spring Boot、jdk 11(使用内部 docker)项目导入 Eclipse 2019 (2021) 时,我遇到了类似的问题,而在导入到 Inteelij IDEA Community 或 NetBeans IDE 时,它们不会产生与导入后相同的一组错误在 Eclipse 中。 The Spring Boot is multimodule maven projects and two child modules give such 2 "problems" in appropriate problems tab: Spring Boot 是多模块 maven 项目,两个子模块在适当的问题选项卡中给出了这样的 2 个“问题”:

The project was not built since its build path is incomplete. 
Cannot find the class file for java.lang.Object. Fix the build 
path then try building this project

Next 2 errors are produced in two classes of aforementioned maven modules:接下来的 2 个错误是在上述 Maven 模块的两类中产生的:

The type java.lang.Object cannot be resolved. It is 
indirectly referenced from required .class files

Manipulation with adding JDK 11 to submodules buildpath just leads to the thousands of problems.将 JDK 11 添加到子模块 buildpath 的操作只会导致成千上万的问题。 Also it is got when I use Eclipse-File-Maven-Update.当我使用 Eclipse-File-Maven-Update 时也会得到它。 Moreover when I try to edit most of existing classes or add new ones I got red underline that tells此外,当我尝试编辑大多数现有类或添加新类时,我得到了红色下划线,表明

Implicit super constructor Object() is undefined for default 
constructor. Must define an explicit constructor

. . So almost no opportunity to use Eclipse even at prebuild stage as docker-compose should run build and run.因此,即使在预构建阶段几乎没有机会使用 Eclipse,因为 docker-compose 应该运行构建和运行。 Indeed I noted that such issue is produced just when project also uses modules (module-info files introduced in java9).事实上,我注意到只有当项目还使用模块(java9 中引入的模块信息文件)时才会产生这样的问题。 When I import project on jdk 8 (even not installed on system), or even on jdk11 without module-info files all is fine in Eclipse after import.当我在 jdk 8(甚至没有安装在系统上)上导入项目时,甚至在没有模块信息文件的 jdk11 上导入后,在 Eclipse 中一切都很好。 Another difference is that of when I use problem old no module project the Build Path is composed with jre environment 8 and maven dependency items, but when using "module-info" project the Build path contains -module path, and -classpath.另一个区别是,当我使用旧的无模块项目时,构建路径由 jre 环境 8 和 maven 依赖项组成,但是当使用“module-info”项目时,构建路径包含 -module 路径和 -classpath。 So I even do not know where to add jre 11, indeed adding does not resolve issue, just make more errors.所以我什至不知道在哪里添加 jre 11,确实添加并不能解决问题,只会犯更多错误。 So what is the resolution of the case???那么案件的解决方案是什么??? What settings to do in Eclipse?在 Eclipse 中要做哪些设置?

I got this out of the blue in a workspace that was working properly before.我在以前正常工作的工作区中突然发现了这一点。 This problem seems to indicate that the project configuration somehow got corrupted.此问题似乎表明项目配置以某种方式损坏。

Restarting Eclipse didn't help, but in the same vein as the answers dealing with Maven, regenerating the Eclipse project config with:重新启动 Eclipse 没有帮助,但与处理 Maven 的答案相同,重新生成 Eclipse 项目配置:

./gradle eclipse

or或者

./gradlew eclipse

if you use the wrapper, solved this problem for me.如果您使用包装器,则为我解决了这个问题。

暂无
暂无

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

相关问题 问题是针对 eclipse javaEE 版本的。 项目未构建,因为其构建路径不完整 - The question is for eclipse javaEE version. The project was not built since its build path is incomplete GGTS该项目未构建,因为其构建路径不完整 - GGTS The project was not built since its build path is incomplete 由于路径未完成,因此未构建该项目。 找不到com.sun.jersey.api.view.viewable的类文件。 - The project was not built since its path is incomplete. Cannot find the class file for com.sun.jersey.api.view.viewable. Eclipse Oxygen 这个编译单元不在java项目的构建路径上 - Eclipse Oxygen This compilation unit is not on build path of java project 我的导入的eclipse项目给出了错误,因为构建路径不完整,所以未构建该项目。 找不到java.lang.object的类文件 - My imported eclipse project gives error the project was not build since the build path is incomplete. Cannot find the class file for java.lang.object Eclipse 氧气 4.7.2:在项目构建路径上找不到 class 'junit.framework.TestCase' - Eclipse Oxygen 4.7.2: Cannot find class 'junit.framework.TestCase' on project build path 在构建路径错误解决eclipse之前,无法构建项目 - Project cannot be built until build path errors are resolved eclipse Eclipse 中的错误:“在解决构建路径错误之前无法构建项目” - Error in Eclipse: “The project cannot be built until build path errors are resolved” 如何将模块添加到项目的Eclipse Oxygen模块路径中? - How do I add modules to the Eclipse Oxygen module path for a project? eclipse 错误:说构建路径不完整 - eclipse error: says build path is incomplete
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM