简体   繁体   中英

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:

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 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).

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? 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.
  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.

And then clean

Edit 1:

If that doesn't resolve the issue try right-clicking on your project and select properties. Select Java Build Path → Library tab. Look for a JVM. If it's not there, click to add Library and add the default JVM. If VM is there, click edit and select the default JVM. Hopefully, that works.

Edit 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). 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:

$ mvn clean eclipse:clean eclipse:eclipse

I'm also using Eclipse Oxygen, migrated from Mars. I faced the same error. I deleted .metadata , .recommenders folders and added projects from archive and issue is solved. I also use Android Studio but i like Eclipse much more.

At my system the Java Runtime JAR file jrt-fs.jar was not found because it was in the wrong directory. This file should be located in the "lib" subfolder. If you installed Java at "C:\\Temp\\java" the file should be here at C:\\Temp\\java\\lib\\jrt-fs.jar .

These are the steps to make jrt-fs.jar available to Eclipse:

  1. Window / Preferences -> the "Preferences" Window opens
  2. Select in the left menu: Java / Installed JREs
  3. Press the [Add...] Button -> A window opens
  4. Select "Standard VM" - The window "JRE Definition" opens.
  5. Enter your path information:
  6. JRE home = "C:\\Temp\\java"
  7. JRE name = "MyJRE"
  8. Select [Add External JARs...] to link the jrt-fs.jar
  9. JRE system libaries: "C:\\Temp\\java\\lib\\jrt-fs.jar"

It worked for me with OpenJDK12 and Eclipse 2019-09 (4.13.0). Eclipse reported me this error:

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. 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. 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.

I guessed it that android library is missing. not the Java, when I saw the errors only at the android methods and imports. 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. The Spring Boot is multimodule maven projects and two child modules give such 2 "problems" in appropriate problems tab:

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:

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. Also it is got when I use 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. Indeed I noted that such issue is produced just when project also uses modules (module-info files introduced in 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. 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. So I even do not know where to add jre 11, indeed adding does not resolve issue, just make more errors. So what is the resolution of the case??? What settings to do in 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:

./gradle eclipse

or

./gradlew eclipse

if you use the wrapper, solved this problem for me.

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