java IntelliJ 无法识别 JDK 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/909282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IntelliJ not recognising JDK version
提问by Esko Luontola
I have write one java project on IntelliJ idea 8.1.1.When I go to compile option of IntelliJ IDEA 8.1.1 then it shows pop-up message box, in that it shows error-
我在 IntelliJ IDEA 8.1.1 上写了一个 java 项目。当我转到 IntelliJ IDEA 8.1.1 的编译选项时,它显示弹出消息框,因为它显示错误-
cannot determine version for JDK
Update JDK configuration.
无法确定 JDK
更新 JDK 配置的版本 。
Even though I have proper JDK version, I have jdk1.5.0 installed in my PC working properly with other environment. Please suggest any settings that I may need to change.
即使我有正确的 JDK 版本,我的 PC 上也安装了 jdk1.5.0,可以在其他环境下正常工作。请建议我可能需要更改的任何设置。
回答by Esko Luontola
I got this same error message just recently in IntelliJ IDEA 9.0.4. "Cannot Detect JDK Version", "Probably JDK installed in C:\Program Files\Java\jdk1.6.0_24 is corrupt."
我最近在 IntelliJ IDEA 9.0.4 中收到了同样的错误消息。“无法检测 JDK 版本”、“可能是安装在 C:\Program Files\Java\jdk1.6.0_24 中的 JDK 已损坏。”
I was able to solve it by removing the JDK from Project Structure | SDKsand then re-adding it.
我能够通过从项目结构中删除 JDK 来解决它| SDK,然后重新添加它。
回答by CrazyCoder
What is the output of the "java -version" for this JDK installation? It could be that the output contains some non-standard strings before the actual version information. Such strings can be added by the environment variables on your system. IDEA may not be able to parse this output and detect the JDK version correctly.
此 JDK 安装的“java -version”输出是什么?可能是输出在实际版本信息之前包含一些非标准字符串。此类字符串可以由系统上的环境变量添加。IDEA 可能无法解析此输出并正确检测 JDK 版本。

