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

查看:3530
本文介绍了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.

当我用模板打开一个新项目时,即使它允许代码运行并正确显示输出,它也会自动在所有地方显示错误:StringSystem之类的标准Java库类以红色突出显示,并且错误工具提示显示:无法解析符号".

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配置类路径" 选项卡. SDK:

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

还要检查项目

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天全站免登陆