Cannot resolve symbol 'java'

I installed Intellij 6.0.5 on a new machine, and I'm getting this error on all my classes:

Cannot resolve symbol 'java'

And all the java packages aren't recognized ('java' is shown in red for import java.util).

I have jdk 1.4.2, 1.5 and 1.6 installed, each one set up in intellij, and I get the same problem when I choose them for the project. If I choose the Intellij IDEA SDK for for the JDK, then things work.

Any ideas why the others don't work? When I look at the JDK dialog, it looks like it has the classpath, sourcepath and javadoc paths all set up properly (same as my other laptop, which works fine).

I'm not sure what else to try...any suggestions?

Thanks in advance.

Comment actions Permalink

Just in case anyone else is having the same problem, I uninstalled all the JDK's / JRE's on my system, and then installed jdk 1.5. Even though it's the same jdk that Intellij was pointing to before, it fixed the problem when the others weren't installed on the machine.

Comment actions Permalink

I had the same problem moving from Windows XP to Ubuntu.  I must have had C:\Program Files\Sun\Javablahblah set in some file or something.  I went into:

Project Structure
under Platform Settings

I deleted the old JDK object and made a new one pointed to /usr/lib/jvm/java-6-sun/ instead.  That did it!

Thanks for your post!  It helped me narrow down the problem and lowered my blood pressure at the same time.

Comment actions Permalink

This is if you see Java classes in red and get this error, "Cannot resolve symbol".

If you're importing projects into IntelliJ and none of the above solutions worked for you then give this a try. This is what worked for me when everything else failed.

Go to to your project folder and rename/delete the .idea folder which has the idea settings for your project. This would have been created from your old IntelliJ version. Once you have renamed/deleted the .idea folder, import your project into IntelliJ. You should not see any errors for your Java classes now. Hope this helped.

Comment actions Permalink

In my case I imported the Intellij settings from a different PC and the java path is pointing to a older version(which is not present). So I just changed the java build path while setting up the project, that worked for me.


Please sign in to leave a comment.