Skip to content
Advertisement

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)

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement