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.

5 comments
Comment actions Permalink

Verify that you have a correctly defined SDK, and that both your project and module use that SDK definition.

Go to File > Project Structure. On the left, select the "Project" page under "Project Settings". On that page, in the "Project SDK" section, make sure it is showing a valid JDK configuration (i.e. verify it is not red). If it shows an invalid SDK, you can either change it, or create a new definition. You can create a new definition either by clicking the "New" button, or going to the "SDKs" page under the "Platform Settings" section on the left.

Once you have verified the project SDK, check the module's definitions. On the left, select "Modules" under "Project Settings" section. Check that each module has a valid SDK defined, In most cases the "Project SDK" option is the most desired unless you have a module that has to use a different JDK.

I suspect there is an issue in one of those settings. If you do not see one, check the SDK definition itself (by editing it) to make sure it has the classes defined. Or you can try creating a fresh definition.

0
Comment actions Permalink

Hi,

I got the exact same problem, Windows 7, JDK 1.7.0_11. Java classes are found, no compiler errors, nothing. Even the Hello World does not start. Tried resetting the SDKs everywhere like a thousand times. Set JAVA_HOME, JDK_HOME. Even reinstalled IntelliJ IDEA. Invalidating cache etc does not help. Setting an alternative JRE in the run configuration does not help either. Has anybody an idea? There is nothing red in the project settings, the SDK is set and everything seems to be correct. Tried importing a project from a co-worker - did not work either. I have absoluetly no clue what to do now :(

0
Comment actions Permalink

Could you please attach /bin/idea.properties file?

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Unfortunatly, there is no /bin folder. I zipped the project folder for you - maybe this helps?



Attachment(s):
untitled.zip
0
Comment actions Permalink

I have tested this on another machine, where IDEA is working - and it works. So it seems like there is something configured wrong within my workstation.... any suggestion? :(

0

Please sign in to leave a comment.