0

I have just installed JDK 1.8 and Eclipse 4.6.0; the old versions worked fine. I was able to convert my old projects to 1.8 just fine. I have problems with new projects. I follow the same steps as with the previous version:

New project → name (and take defaults) → finish

New class → choose source folder as src sub-directory of the project just created → accept default of superclass (Object) or blank it out (doesn't make any difference)-> finish

Error message on package declaration: The type java.lang.Object cannot be resolved

Error message on class declaration: implicit super constructor Object() is undefined for default constructor

Thank's for your assistance.

peter gottlieb
  • 441
  • 2
  • 5
  • 9
  • 2
    Try the following: http://stackoverflow.com/questions/18075343/java-project-in-eclipse-the-type-java-lang-object-cannot-be-resolved-it-is-ind – Wojtek Oct 05 '16 at 19:22

3 Answers3

0

Remove your JRE from eclipse build path and add again.

1.Right click on project > Build path > configure build path.

2.Select the Libraries tab, you should see the Java 1.8 jre with an error

3.Select the java 1.8 jre and click the Remove button.

4.Add Library... > JRE System Library > Next > workspace default > Finish.

5.Close properties window

6.Clean your project -> Go to the project menu > Clean... > OK

Sundararaj Govindasamy
  • 8,180
  • 5
  • 44
  • 77
0

try below:

1. Go to properties of project with the build error (right click > Properties)
2. View the "Libraries" tab in the "Build Path" section
3. Find the "JRE System Library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project)
4. Remove the "JRE System Library"
5. Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE')
6. Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project
7. Hopefully the error will be resolved ...

Else try

Eclipse–>Preferences–>Java–>Compiler–>Building–>Output folder–>”Rebuild class files modified by others”.

  • for reference: http://philip.yurchuk.com/software/eclipse-cannot-be-resolved-to-a-type-error/ http://dev-answers.blogspot.in/2009/06/eclipse-build-errors-javalangobject.html – Anil Reddy Oct 06 '16 at 05:19
0

i think you need to change java version to 1.8 in eclipse, Just follow the steps, it may help you

enter image description here

select build path

enter image description here

chnage project facts -> java 1.8 -> apply -> ok

Sangram Badi
  • 4,054
  • 9
  • 45
  • 78
  • Right clicking on the project doesn't get anything. However, I was able to verify, under project->properties, that Eclipse is using 1.8, so I don't see what more I can do in that regard. Also, I said in my problem statement, that all my previous projects got converted to 1.8 automatically, and they compile and execute just fine. – peter gottlieb Oct 07 '16 at 02:10