Reputation: 78491
What are common causes for IntelliJ IDEA not being able to resolve built-in JVM types and methods? For example, when I mouse over String
the tooltip says "Cannot resolve symbol 'String'". It's as if IntelliJ has doesn't know where the JVM is.
By the way, I am running OS X 10.6.6. Everything was working fine until I ran the system update this morning.
Upvotes: 117
Views: 297946
Reputation: 1
I edited the pom.xml with this:
<properties>
...
<maven.compiler.release>17</maven.compiler.release>
...
</properties>
Upvotes: -1
Reputation: 1
I solved the issue by selecting a different sdk under project structure. Also, I'm using macOS. Actually, I was using openjdk-20, I selected openjdk-19 and it resolved.
Upvotes: 0
Reputation: 151
In my case, right click on String then choose "Show Context Actions", it will give you option to Setup JDK, then click always downloaded. Then the error will be gone.
Upvotes: 0
Reputation: 695
I tried almost everything but nothing was helping with the ibm jdk 1.8. to fix this issue. then I found an article from https://youtrack.jetbrains.com/issue/IDEA-279214/Cannot-resolve-symbol-String-when-using-IBM-JDK-180 and it worked like charm!!!
so sharing original help credit goes to @Serge Barano. incase anybody needs and not able to able to resolve the issue using previous solutions like me.
according to the article answer is:
IBM JDK has a weird layout and the jar with the String class is in bin directory for some reason:
d:\dev\ibm_sdk80\jre\bin\default\jclSC180\vm.jar
If you add it to the JDK classpath in IntelliJ IDEA, the issue should resolve:
Upvotes: 4
Reputation: 606
In my case, cloning repo from the remote was the easiest way to solve this issue.
Upvotes: 1
Reputation: 616
For me ,
File -> project structure -> Project Language Level (11) selection worked. Local variable syntax for lambda paramters.
Upvotes: 0
Reputation: 551
First of all you should try File | Invalidate Caches and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
Upvotes: 4
Reputation: 523
For me, I had to remove the intellij internal sdk and started to use my local sdk. When I started to use the internal, the error was gone.
Upvotes: 4
Reputation: 1677
I was facing the same problem when import projects into IntelliJ.
for in my case first, check SDK details and check you have configured JDK correctly or not.
Go to File-> Project Structure-> platform Settings-> SDKs
Check your JDK is correct or not.
Next, I Removed project from IntelliJ and delete all IntelliJ and IDE related files and folder from the project folder (.idea, .settings, .classpath, dependency-reduced-pom). Also, delete the target folder and re-import the project.
The above solution worked in my case.
Upvotes: 5
Reputation: 3592
For me, IntelliJ could autocomplete packages, but never seemed to admit there were actual classes at any level of the hierarchy. Neither re-choosing the SDK nor re-creating the project seemed to fix it.
What did fix it was to delete the per-user IDEA directory ( in my case ~/.IntelliJIdea2017.1/
) which meant losing all my other customizations... But at least it made the issue go away.
Upvotes: 3
Reputation: 801
First check if you have configured JDK correctly:
Secondly check if you have provided in path in Library's section
This should fix the problem
Upvotes: 72
Reputation: 402443
Most likely JDK configuration is not valid, try to remove and add the JDK again as I've described in the related question here.
Upvotes: 128