20

I reinstalled my eclipse. and then imported all the projects in the Eclipse, but every project has a common error:

Cannot find the class file for java.lang.Object. at Line 1.

I have checked my Java Path. But not able to sort it out.

7
  • 1
    check 'problems' tab in eclipse. what does it say? Commented Apr 2, 2013 at 6:19
  • 2
    Check if JAVA_HOME is set correctly, also if JDK/JRE is correctly configured in your IDE. Commented Apr 2, 2013 at 6:23
  • 1
    I check it.. I got the above error from there itself Commented Apr 2, 2013 at 6:24
  • @Sudhanshu: where to check that.? Commented Apr 2, 2013 at 6:26
  • 1
    Window / Preferences / Java / Installed JREs Commented Apr 2, 2013 at 6:34

9 Answers 9

25

Right click on Project--> Properties, Java Build Path.

enter image description here

Check whether you have JRE installed. If installed click on EDIT and check whether its pointing to correct location

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I have check the JRE packages.!! it's not from there.
If it isn't there - add it via the "Add Library" button.
14

Check this if it works:

There is a problem with your java repositories. I guess..:

goto Help>Install New Software> Click on Add Button .

on popup:

Name: ADT

Location:https://dl-ssl.google.com/android/eclipse

Install all the available softwares in the list. This may work.

Have a good day!!!

3 Comments

is it a android question ?
Thank you... It worked. but could you please explain me why this happened.? because I guess installing eclipse allows me to write code. and what is this to with Class file java.lang.Object
For anyone trying this and getting a 'Not Found' error, it looks like Google updated the url to: dl-ssl.google.com/android/eclipse
10

A quicker way will be

Right Click Project---> Properties--->Build Path--->Add External Jars--> Find your android-xx.Jar e.g android-17.jar

In my case I'm using the adt and it is here

E:\adt-bundle-windows-x86_64-20130219\adt-bundle-windows-x86_64-20130219\sdk\platforms\android-17

Hope it helps

Comments

4

This happened to me when I tried to merge two branches of an Android project using eGit. For some reason my build path basically disappeared (possibly one of the files was untracked).

To get the JRE and android libraries back, I just right-clicked on the project in the project explorer, and hit Android Tools -> Fix Project Properties (these options are only available if you have Android ADT installed).

Comments

3

I just had this problem and all I had to do was clean the entire workspace, i.e. all projects in the workspace. The error went away.

1 Comment

Similar here, it was working for most of the projects except one particular, cleaning all workspace helped
3

Try this:

Go to Build Path -> Libraries -> Add Library -> JRE System Library -> Select JRE

I am not sure but you might be missing JRE System Library in your project, this does not happen often but it is possible.

Comments

0

I've had this problem after installing a newer version of Google ADT. The solution, at least running OS X, is to make a copy of your project to a safe location, delete it completely from Eclipse and then import it again using File->Import->General->Existing Projects into Workspace.

FYI

I am Using Google's on OS X Mavericks Android Developer Tools Build: v22.2.1-833290

but I am almost sure I have done in the past with previous OSX and ADT versions.

Comments

0

I had this issue too and in my case the issue was that the following line was missing from the .classpath file of the current project:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

Adding it solved the problem for me.

Comments

-1

This error is because one of "Android Private Libraries" is either corrupted or of wrong version. In my case it was android-support-v4.jar. I replaced it with one from a working project and it works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.