70

When I use quick documentaion lookup (Ctrl+Q) on j2ee classes or annotations in IDEA I only get an empty javadoc. It only contains the basics like class name.

How do I add the javadoc to the libs IDEA provides itself?

cynicalman
  • 5,861
  • 3
  • 30
  • 30
homaxto
  • 5,428
  • 8
  • 37
  • 53

4 Answers4

97

You can attach javadoc to any library you have configure in your module or project. Just access the project structure windows (File -> Project Structure), then select "modules" and select the module that has the dependency you want to configure.

Then select the "Dependencies" tab, select the dependency that's missing the javadoc and click "Edit". In the window that just showed up you see two buttons "Add" and "Specify Javadoc URL". If you have the javadoc in a jar file select the first one, if you want to point to a web site that contains the javadoc select the latest. That's it.

Alexandre Daubricourt
  • 3,323
  • 1
  • 34
  • 33
Hugo Palma
  • 3,376
  • 3
  • 21
  • 22
  • 5
    I use a directory where I keep all my libraries. I show put my jars there and they are automatically added to the classpath. How can I do the same with the javadoc archives? – simao Feb 04 '11 at 00:26
  • 4
    If you have maven or gradle dependency handling, you can also switch on an autofetch on documentation, This will autmatically add the right JavaDoc for the dependency. You can find the option under: File > Settings > Build, Execution, Deployment > Build Tools > Maven > Importing : Automatically Download : Documentation – Xtroce Apr 14 '16 at 11:09
  • 2
    I use Android Studio which is based on Intellij Idea but it doesn't have any of the options described here. – vovahost Jul 21 '17 at 14:42
  • If you have a zip, jar, or directory with the documentation downloaded, just add it the same way you add other zips, jars, and directories (normal plus) and it will be used as a JavaDoc. – Solomon Ucko Dec 28 '17 at 16:07
  • Can somebody please kindly specify in which format I should specify the path to a local directory with docs? – vintprox Jul 31 '20 at 07:06
21

If using maven:

"right click on your pom.xml" -> "Maven" -> then choose "Download Sources and Documentation"

To avoid this in the future: "Preferences" -> "Build, Execution, Deployment" -> "Build Tools" -> "Maven" -> "Importing" -> Check the Automatically download Sources and Documentation boxes.

Credit to Yacov Schondorf and Stephen Boesch from Intellij user forums.

JMess
  • 623
  • 9
  • 11
1

What about documentation for an extension API? I had added the j3d API to my jdk1.6 and use it succesfully, next step, get the javadoc

Forget the links on java.sun.com (It is a mess) Go directly to java.net and get all the stuff (API, javadoc, get the source even -for every package-)

Go to your jdk and selected the documentation path and add the javadoc zip. Go to the source tab and add the source's zip

You're done.

Actually only the source is needed to enjoy javadoc and the uncompiled classes

albfan
  • 12,542
  • 4
  • 61
  • 80
0

right click on the maven pom.xml -> "Maven" ->Download documentation,wait for a sec,you'll make it!