148

I just installed IntelliJ IDEA and when I try to create my first Project it asks for me to set up the Project SDK. When I click on "JDK" it asks for me to select the home directory of the JDK as shown in this image.

enter image description here

I'm having trouble locating where it is.

Melchia
  • 22,578
  • 22
  • 103
  • 117
user2419553
  • 1,617
  • 2
  • 12
  • 7

2 Answers2

198

For a new project select the home directory of the jdk

eg C:\Java\jdk1.7.0_99 or C:\Program Files\Java\jdk1.7.0_99

For an existing project.

1) You need to have a jdk installed on the system.

for instance in

C:\Java\jdk1.7.0_99

2) go to project structure under File menu ctrl+alt+shift+S

3) SDKs is located under Platform Settings. Select it.

4) click the green + up the top of the window.

5) select JDK (I have to use keyboard to select it do not know why).

select the home directory for your jdk installation.

should be good to go.

MindRoasterMir
  • 324
  • 1
  • 2
  • 18
BevynQ
  • 8,089
  • 4
  • 25
  • 37
  • 2
    Hey , so far i did all the required things and i still get ** Error:Invalid SDK Home path set. Please set your SDK path correctly. ** .. Any further help ?? – HasS May 09 '16 at 12:54
  • ultimate 2016.1 but never mind i fixed it :) thanks anyway – HasS May 10 '16 at 09:52
  • 20
    On Mac OSX find it with `$ echo $(/usr/libexec/java_home)` --gives me `/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home` – MarkHu Feb 17 '17 at 19:26
  • 2
    I had to select JDK version in "Project" tab also (present in "Project Structure" dialog box) to run my project. – learner Aug 26 '17 at 07:15
  • @HasS I had the same problem. My project used Maven so I just replaced any occurrence of 1.8 in pom.xml with 1.7 and that fixed it. – Arya Pourtabatabaie Oct 06 '17 at 15:06
71

For IntelliJ IDEA 2017.2 I did the following to fix this issue: Go to your project structure enter image description here Now go to SDKs under platform settings and click the green add button. Add your JDK path. In my case it was this path C:\Program Files\Java\jdk1.8.0_144 enter image description here Now Just go Project under Project settings and select the project SDK. enter image description here

Melchia
  • 22,578
  • 22
  • 103
  • 117