問題描述
我最近將 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 類的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!