Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intellij - java: Cannot find JDK '1.7' for module

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.

like image 844
Scott Barnes Avatar asked Jan 11 '13 13:01

Scott Barnes


People also ask

Where is my JDK in IntelliJ?

From the main menu, select File | Project Structure | Project Settings | Project. If the necessary JDK is already defined in IntelliJ IDEA, select it from the SDK list.

Do I need to install JDK before IntelliJ?

Pre-release versions are not supported. You do not need to install Java to run IntelliJ IDEA because JetBrains Runtime is bundled with the IDE (based on JRE 11). However, to develop Java applications, a standalone JDK is required.


2 Answers

project structure > project > choose correct jdk

or ctrl+alt+shift+s > project> choose correct jdk

also platform settings > SDK's >and make sure 1.7 is there.

like image 54
NimChimpsky Avatar answered Oct 04 '22 02:10

NimChimpsky


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

like image 35
Scott Barnes Avatar answered Oct 04 '22 04:10

Scott Barnes