Annie
Annie

Reputation: 41

My copy of Eclipse doesn't know what an object or a String is

I have a copy of Eclipse Indigo on my mac. It was working fine until I imported a project I had made on a different computer. Now I get errors like "The type java.lang.Object cannot be resolved." and "String cannot be resolved to a type".

Also, the computer I built it on had Java 7, while my slightly broken mac has Java 6, and won't update. I'm not sure, but I suspect this may be an issue.

What happened, and how do I fix it?

UPDATE

I put what I think is the right JRE in the build path, but now when I run it, I get these errors:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Game : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Upvotes: 3

Views: 12694

Answers (5)

UNREAL
UNREAL

Reputation: 506

goto quickfix->project-setup->manually-> set your jde to default, This solved my problem

Upvotes: 0

viveksinghggits
viveksinghggits

Reputation: 680

I got the very same error but after some digging I got to know about http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html

They are just saying to remove the JRE library and add Default System JRE Library.

Upvotes: 2

Your workspace is broken, notably the JRE you try to use.

Fix the JRE used in Eclipse and the compiler settings, and then rebuild the project.

Upvotes: 2

Andrea Colleoni
Andrea Colleoni

Reputation: 6021

Verify if you have a Runtime Enviroment in your build path.

Object and String are at least in a JRE and the JRE must be referenced in the build path.

If you create a new java project you'll find there by default, but it's there.

The project build path can be broken by moving the JRE or JDK, changing the JAVA_HOME environment variable or by misconfiguration of custom System libraries that refer to specific JREs.

Upvotes: 9

melopsitaco
melopsitaco

Reputation: 186

Check your classpath. It must point to your JDK.

Upvotes: 0

Related Questions