Cannot resolve symbol 'String'

For some reason, build 2233 on Mac OS X.3.4 with JDK 1.4.2_03 claims it can't resolve even basic java.lang symbols. Everything compiles fine and runs fine under IDEA but the bulb keeps suggesting I create a class or interface called 'String'. I've double-checked the JDK and library settings as well as the project JDK setting and they appear to be fine. I tried creating a trivial project and get the same error. No errors are showing up in console.

Anyone else experience this? I'm convinced it's some incorrect setting but can't seem to find it for the life of me.

17 comments
Comment actions Permalink

Sean Chou wrote:

this? I'm convinced it's some incorrect setting but can't seem to find it for the life of me.

I'd start from Settings|Paths|Libraries|JDK


--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

That's what I meant when I said I specified the project JDK. I double checked it just in case and it's set to JDK 1.4.2_3 which, in turn, is pointing to /Library/Java/Home under the IDE Settings/JDK&Global Libraries.

I added other Jars to the project and those classes seem to get picked up.

0
Comment actions Permalink

Hi,

I had the same problem when I wanted to use Java 1.5 Beta 2 installed into a non-default directory. After re-installing it (on Windows) where it wanted to go (under C:\Program Files\Java) and choosing jdk1.5.0, the problem went away.

Cheers, Alex

0
Comment actions Permalink

Sean Chou wrote:

That's what I meant when I said I specified the project JDK. I double checked it just in case and it's set to JDK 1.4.2_3 which, in turn, is pointing to /Library/Java/Home under the IDE Settings/JDK&Global Libraries.

I added other Jars to the project and those classes seem to get picked up.


If you're on Mac the JDK point should look like follows: /System/Library/Frameworks/JavaVM.framework/Home

--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Still no luck. I'm wondering if my system is brain damaged...

0
Comment actions Permalink

Sean Chou wrote:

>Still no luck. I'm wondering if my system is brain damaged...

>
I usually see that when the configured JDK is no longer valid ( newer
JDK installed and the paths no longer valid ).

Check that...

0
Comment actions Permalink

Also check that a valid JDK is defined for each module in your project.

Sean Chou wrote:

>> Still no luck. I'm wondering if my system is brain damaged...
>>

I usually see that when the configured JDK is no longer valid ( newer
JDK installed and the paths no longer valid ).

Check that...


0
Comment actions Permalink

I double checked for a valid JDK path as well as made sure each module has a proper JDK (even tried setting a module specific JDK). The funny thing is that I can actually browse down to the Library/]]>/classes.jar/java/lang/String.class. So I know it's there...it's just somehow not getting recognized.

I also recreated my project and get the same error. All other libraries are recognized. Heck, I just tried adding classes.jar as a library jar just to see if it'd do the trick, but no go. It still all compiles.

0
Comment actions Permalink

Are you seeing this in a JSP, Java class, or both?

Have you tried restarting the app?

I double checked for a valid JDK path as well as made sure each module
has a proper JDK (even tried setting a module specific JDK). The funny
thing is that I can actually browse down to the Library/<java version
"1.4.2_2">/classes.jar/java/lang/String.class. So I know it's
there...it's just somehow not getting recognized.

I also recreated my project and get the same error. All other
libraries are recognized. Heck, I just tried adding classes.jar as a
library jar just to see if it'd do the trick, but no go. It still all
compiles.


0
Comment actions Permalink

Eric Silva wrote:

>Are you seeing this in a JSP, Java class, or both?
>
>Have you tried restarting the app?

>
Also - what platform... windows ? linux ? mac?

If linux - is it a 2.6 kernel?

0
Comment actions Permalink

I have no JSPs so I only know I'm seeing them in Java. I'm using Mac OS X 10.3.4 with JDK 1.4.2_03.

0
Comment actions Permalink

SOLUTION:

 

You most likely didn't set up your SDK. That's why it cannot recognize String and other basic stuff... On Windows, just go File -> Project Structure and under Project Settings, you will see Project, click on that and then look on Project SDK and choose a
different version of Java 1.8 or whatever and apply and see which one works! Good luck.

-4
Comment actions Permalink

Don't claim to have a solution if you don't have one moron.

>SOLUTION:

>You most likely didn't set up your SDK. That's why it cannot recognize String and other basic >stuff... On Windows, just go File -> Project Structure and under Project Settings, you will >see Project, click on that and then look on Project SDK and choose a 
>different version of Java 1.8 or whatever and apply and see which one works! Good luck.

 

I am experiencing the same problem. JDK and SDK are set, but the IDE still does not recognize any default Java classes.

https://i.imgur.com/U1T33o4.png 

https://i.imgur.com/Rw6Tp3O.png 

1
Comment actions Permalink

Have you tried to re-create your SDK or use Oracle JDK?

1
Comment actions Permalink

After downloading jdk-9.0.1_linux-x64_bin.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html and re-adding the SDK and setting the project SDK fixed the problem. I am now able to import the classes from standard lib.

 

Thank you.

0
Comment actions Permalink

write String not string 
make sure S is upcased 
that's worked for me hhh

-3
Comment actions Permalink

In my case, the correct SDK was shown in the project settings, but it seems that it was not listing all needed files. This happened right after installing IntelliJ for the first time and importing an existing gradle project.

After I removed the SDK and added it again, everything works fine.

0

Please sign in to leave a comment.