64

The shortcut for this action is Shift+F1 but it is always grayed out even though I have pointed JDK documentation path to the docs folder (the docs folder is unzipped from jdk-7u2-apidocs.zip ).
Thanks

cb4
  • 6,689
  • 7
  • 45
  • 57
JatSing
  • 4,857
  • 16
  • 55
  • 65

8 Answers8

107

You need to specify the docs/api subdirectory of the unpacked documentation or use https://docs.oracle.com/javase/8/docs/api/ URL for the external documentation feature to work.

File -> Project Structure... then here : enter image description here

Opsse
  • 1,851
  • 2
  • 22
  • 38
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Thanks, it works ! Additionally, is there a way to make it display documentation in HTML format ? – JatSing Dec 23 '11 at 01:57
  • What do you mean? It just opens the HTML page in the default browser. – CrazyCoder Dec 24 '11 at 14:29
  • Sorry for confusing. I asked if I can make it display in HTML format in the documentation window in IntelliaJ IDEA (Ctrl+Q) for quick view purpose. – JatSing Dec 26 '11 at 02:07
  • Ctrl+Q is rendered either from the source javadoc or from the HTML documentation, it's the same documentation as you see in the HTML format. – CrazyCoder Dec 26 '11 at 03:23
  • 1
    It misses some images and rich formats compared to HTML in browser. – JatSing Dec 26 '11 at 03:26
  • Where do I need to add the http://download.oracle.com/javase/7/docs/api/ path for this feature to work? – Mathias Bader Oct 15 '14 at 15:32
  • 3
    Link should now be [https://docs.oracle.com/javase/8/docs/api/](https://docs.oracle.com/javase/8/docs/api/) (note the 'https' and the '8'). I tried to edit but SO won't let me change just two characters :/ – MikeFHay Sep 07 '15 at 15:34
  • I'm looking for the location where OpenJdk has it's javadocs locally. I don't have access on the developer system to reach out to any http:// path. Where would I find the javadocs located? – edjm Jan 25 '19 at 17:11
  • @Elijah JavaDoc is not a part of the JDK, you need to download/unpack them manually. – CrazyCoder Jan 25 '19 at 18:20
16

I'm using 10.5.4. It was unclear to me from the docs or from resources online that you need to add this at Project Structure > SDK's > (Choose your SDK) > Documentation Paths > Specify URL.

mozboz
  • 1,070
  • 12
  • 24
6

You can add the external Javadocs API link as shown below:

enter image description here

Saikat
  • 14,222
  • 20
  • 104
  • 125
5

For IntelliJ Idea: Call "Project Structure" (Ctrl+Shift+Alt+S), go to "Platform Setting - SDKs", choose "Documentation Path" tab on the right, then add url of JavaDoc (http://docs.oracle.com/javase/7/docs/api/) to your project

Aconic
  • 737
  • 8
  • 4
2

I understand the question as follows:

You would like to see javadocs of classes that are not within JDK. I am a bit uncertain because CrazyCoder's reply is talking about JDK specific javadocs.

I am using Macos 10.8.4 and Intellij 11.1.5

The project I am working on is a mvn based project with many modules which have complex dependencies.

Let me take a concrete example to explain what I did, I am sure it can be reproduced for others: apache sshd

I downloaded the javadoc from maven central stored it stored it somewhere. In intellij I went to the module settings (shortcut F4) and the to Libraries in the sidebar. Maven pulls all dependencies automagically and I can find sshd there. The right side then shows Classes, Sources and JavaDocs. The JavaDocs part in my case had a path linked in that pointed to my local m2 directory. However the directory did not contain the javadoc jar file. So I thought how do I get it:

mvn dependency:resolve -Dclassifier=javadoc

Taken from here

However this failed for because we do not have some javadocs in our nexus (I guess, not sure).

So I ended up linking the file that I downloaded manually in as a javadoc link and this then allown me to use Shift+F1 for the javadoc to open in my standard browser.

Maybe others can elaborate on how to get this done with mvn. I did not have the time to further investigate.

user637338
  • 2,565
  • 1
  • 25
  • 26
2

Posting this here in case you're like me and don't necessarily want javadocs, but rather the documentation inside your IDE.

In my situation, I had downloaded OpenJDK 11 and wasn't able to get documentation inside IntelliJ. Instead I was getting decompiled code.

What helped me was the answer at https://stackoverflow.com/a/38413439 i.e.

  1. Go to File > Project Structure > SDKs > Sourcepath > '+' on the right side.
  2. Navigate to your JDK (I'm on Ubuntu so it was located under /usr/lib/jvm/openjdk-11/).
  3. Select the src.zip (for me, /usr/lib/jvm/openjdk-11/lib/src.zip).
  4. Click OK > OK (to "Choose Roots" pop-up) > OK (to Project Structure)

Let Intellij index and it should be available in your IDE.

Alexander Terp
  • 199
  • 2
  • 12
1

Java 10 Documentation path

Got to File -> Project Structure Choose External URL

Below Link works Fine... THe default one does'nt work

https://docs.oracle.com/javase/10/docs/api/

IndiGo
  • 101
  • 1
  • 1
  • 9
0

Other answers are satisfying but in case you still can't see the documentation, make sure that your java file is located under the src path.

Luke
  • 965
  • 8
  • 21