IntelliJ - java: Cannot find JDK '1.8'

匿名 (未验证) 提交于 2019-12-03 08:35:02

问题:

Update: Not sure why this is marked as a duplicate. I had already linked to the other post stating that none of the suggestions / answers work for me. In addition, their question seems to be related to an issue using Windows VMs via Mac, which is irrelevant for me.

I am using IntelliJ IDEA 14.0.3. I have selected the 'Java Hello World' sample. When I try and run the program I receive the error: "Error: java: Cannot find JDK '1.8' for module 'Deliverable4'. I have tried every single suggestion from this post intellij - java: Cannot find JDK '1.7' for module but still can't this to work. Any help would be greatly appreciated.

回答1:

Go to:

File => Project structure

And check: Project, Modules and SDKs tabs:

If at SDKs Java 1.8 Sdk isn't selected just add it.

And press OK.



回答2:

Updating from IntelliJ version 14.0.3 to 14.1 seemed to fix the problem.



回答3:

If the update solution given above doesn't work for somebody, consider not using the bin directory like the one used in the PATH environment but rather the java root directory. In short instead of:

path_to_java_folder\java\bin\

use:

path_to_java_folder\java\

and everything will work just fine.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!