intellij - java: Cannot find JDK '1.7' for

2019-01-27 13:15发布

I've just installed IntelliJ on Windows 8 (and 7). I then use the 'Java Hello World' Sample as my project.

I then selected the JDK that was installed (C:\Program Files\Java\jdk1.7.0_10). Project creates successfully and I can see all the classes associated with the project etc. When I "make the project" I get the following error:

Compilation completed with 1 error and 0 warnings in 2 sec
1 error 
0 warnings
java: Cannot find JDK '1.7' for module 'TEST'

No matter what I do I cannot compile any Java code under Windows8/IntelliJ

I have tried the following:

  • Invalidating cache.
  • Switching to 32bit JDK instead of 64bit
  • Idea64.exe instead of idea.exe
  • Installing 1.6 incase it was a 1.7 issue??
  • Changed the JAVA_HOME to point to different versions (ie currently C:\Program Files\Java\jdk1.7.0_10)

I'm lost as to why this is happening.

7条回答
啃猪蹄的小仙女
2楼-- · 2019-01-27 13:37

Found the root of the problem. Turns out Windows 8 under parallels shares the same Desktop as OSX. This confused IntelliJ somehow and as a result it couldn't compile properly.

In parallels by removing the "Desktop" shared under Configure this then resolves the issue.

enter image description here

查看更多
登录 后发表回答