Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK documentation in IntelliJ IDEA on Mac OS X

I'd like to know how to setup IntelliJ to point to the JDK documentation so the documentation popups that display during code completion will show me what the function I'm looking at is going to do. For some reason IntelliJ isn't able to find the JavaDocs by default.

I'm also not 100% sure that the documentation is installed with the JDK that's installed with the OS. I don't see them in /System/Library/Frameworks/JavaVM.framework/ but I may be looking in the wrong place. If it's not included, I'd also like to know what needs to be downloaded and where it needs to be installed to get the JavaDocs for the JDK to show up in IntelliJ.

like image 659
Chris Williams Avatar asked Nov 10 '10 14:11

Chris Williams


People also ask

How do I add Java documents to IntelliJ?

put the cursor on the method name you want to add javadoc ,and then press alt + enter, there will be an add javadoc option in the popup. If the method already has a javadoc,then there will be no add javadoc option.


2 Answers

I had to combine the responses I got to this point and add a few extra details so I'm answering my own question.

  1. Search for "Java developer" from Downloads for Apple Developers
  2. Download and install "Java for Mac OS X 10.6 Update 9 Developer Package" (or later).
  3. In IntelliJ, open File -> Project Structure.
  4. Click on "SDKs" under "Platform Settings".
  5. Add the following paths under the "Documentation Paths" tab (the paths may be different based on which JDK you're using):

    /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/docs.jar!/docs/api   /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/appledocs.jar!/appledoc/api 
  6. Add the following path under the Sourcepath tab:

    /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/src.jar!/src 

Thanks, @Yishai for the download location and @Gareth Davis for the location of the documentation after installing.

Update for 10.7/10.8 [Mountain] Lion:

Steps are the same except for these changes:

  1. In step 2, download "Java for OS X 2012-005 Developer Package" (or later).

  2. Use these paths instead in step 5.

    /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/docs.jar!/docs/api   /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/appledocs.jar!/appledoc/api 
  3. Use these paths instead in step 7.

    /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/src.jar!/src   
like image 104
Chris Williams Avatar answered Sep 16 '22 17:09

Chris Williams


Quick (and dirty?) solution: Point IntelliJ to http://download.oracle.com/javase/6/docs/api/

like image 41
Arne Evertsson Avatar answered Sep 20 '22 17:09

Arne Evertsson