IntelliJ IDEA: “cannot resolve symbol” for String, System and other Java classes

心已入冬 提交于 2020-05-05 05:26:24

问题


I recently downloaded IntelliJ IDEA to a different computer. On one computer it works fine on the other computer it is giving me this current issue.

When i open a new project with a template it automatically shows errors everywhere even though it allows the code to run and shows the output correctly: standard Java library classes like String and System are highlighted in red and the error tooltip says: "cannot resolve symbol".

I have tried "Invalidate caches/Restart", but it didn't help.

Basic code showing errors in JDK classes


回答1:


Check the JDK configuration Classpath tab in Project Structure | SDKs:

Also check that project and modules use the same JDK.

If it's empty, remove the JDK and add it again. It's not recommended to use JetBrains Runtime as your JDK, download and configure some different standalone JDK instead, 2020.1 version can download JDK for you.

Important notice The bundled JRE is used for running the IDE itself, and it's not sufficient for developing Java applications. Before you start developing in Java, download and install a standalone JDK build.



来源:https://stackoverflow.com/questions/61180304/intellij-idea-cannot-resolve-symbol-for-string-system-and-other-java-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!