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.

3
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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.

-2
Avatar
Permanently deleted user

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 

0

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

1
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

-4

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.

1

 @... thank you its working also for me i have just turned S to upcase caracter its fine now hhhh 

0

I solved the issue by selecting a different sdk under project structure. the issue was, that i've selected one from intelliJ itself with the path`/Users/username/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/202.6948.69/IntelliJ IDEA.app/Contents/jbr/Contents/Home`

which most probably was only a runtime without the developer kit.

0

I am also on the same boat.

What worked for me is, setting the Project-SDK as "16 version 16.0.2".

My Intellij version

0

请先登录再写评论。