« back

Getting Your SDK Set Up With Intellij

14 Jan 2013

Intellij + JDK getting in your way? Read on.

While embarking on my Java quest, I needed to get set up. I will be using Intellij and jUnit. You can find the Intellij download here. Installation is pretty straight forward. You can download jUnit from here. I was a little unsure on the installation of jUnit but I found this pretty helpful. One thing to keep in mind is that you may want to put the jar file within each project. You can set your environment up to always point to one jar file but you may end up with different versions and this can throw things off. The main thing is that you need to make sure it can be found on your CLASSPATH.

Now, before you can actually use Intellij, you need an SDK (Software Development Kit). This is a set of development tools. I used the javaSDK. You can find it here. I had a bit of an issue with getting this set up to be used by my projects. You are supposed to be able to add this when creating a new project but the drop down was not working and the add button was not working either. The way I remedied this was to go into the Project Structure Dialog and to add it from there.

When in Intellij, you can press (command + ;) to bring up the Project structure dialog.

Once there, you should see a section that says Project SDK:

As long you have actually downloaded the JDK, you will see an option to select it. Do this. Now if you know where it lives, select where you know it is. If you do not know where it lives, go to the command line and type "which javac" this should give you a path. You can copy this.

Then go back to the Project Structure Dialog where you have clicked new. with the selector menu dropped down, hit (command + shift + g). This will drop down a menu to let you navigate to a directory even if the files are usually hidden in finder. You can paste the path copied from the command line and hit go(or enter). This should navigate you to where you want to be. You can then hit choose (or enter).

You should see a little icon in that SDK dropdown now. If not, read on...

If you are having problems still, Try navigating to or using the Go(command + shift + g) and then typing in something like this...
/Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home
the section that says jdk and the version number should match whichever version that you have.

That *should* do it. You can then go ahead and click OK.

Then when you go back to File -> New Project, you should be able to click the Java Module icon on the left hand side and have it load your SDK into the "suppos-ed" drop down menu.

YAY!

comments powered by Disqus