问题描述
我最近将 IntelliJ IDEA 下载到了另一台计算机上.在一台计算机上,它在另一台计算机上运行良好,它给了我这个当前的问题.
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.
当我使用模板打开一个新项目时,它会自动在各处显示错误,即使它允许代码运行并正确显示输出:标准 Java 库类,如 String
和 System
以红色突出显示,错误工具提示显示:无法解析符号".
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.
推荐答案
检查项目结构中的JDK配置Classpath选项卡|SDK:
Check the JDK configuration Classpath tab in Project Structure | SDKs:
同时检查 项目 和 模块 使用相同的 JDK.
Also check that project and modules use the same JDK.
如果为空,请删除 JDK 并重新添加.不建议使用 JetBrains Runtime 作为 JDK,下载并配置一些不同的独立 JDK,2020.1 版本 可以为你下载 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.
重要通知捆绑的 JRE 用于运行 IDE 本身,这对于开发 Java 应用程序是不够的.在你面前开始使用 Java 进行开发,下载并安装独立的 JDK 版本.
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.
这篇关于IntelliJ IDEA:“无法解析符号";用于 String、System 和其他 Java 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!