IntelliJ IDEA:“无法解析符号"用于 String、System 和其他 Java 类 [英] IntelliJ IDEA: "cannot resolve symbol" for String, System and other Java classes

查看:69
本文介绍了IntelliJ IDEA:“无法解析符号"用于 String、System 和其他 Java 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将 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 库类,如 StringSystem 以红色突出显示,错误工具提示说:无法解析符号".

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:

还要检查 project模块 使用相同的 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 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆