1

Whenever I access the documentation of Java's standard library (using Ctrl + q), there's considerable lag until the documentation appears.

It seems that IntelliJ connects to a server to get the documentation, which is slow.

I'd like to speed things up; how do I configure IntelliJ to access Java documentation on my local machine?


I'm using OpenJDK 11 on Arch Linux 5.0.7.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171

1 Answers1

3

The reason why displaying the documentation was slow, is that IntelliJ indeed fetched the documentation via a remote URL.

In Project Structure (press F4 in the project view) → Platform Settings → SDKs → Documentation Paths, I had

https://download.java.net/java/early_access/jdk11/docs/api/

as the location of the JDK documentation.

This explains the slowness, how can we make it faster?

1. Download the documentation

Independent of your operating system, you can get the documentation by using one of the links in this answer.

On Arch Linux, you can install the documentation as a package with pacman -S openjdk-doc which has the benefit that you'll get updates of the JDK documentation when updating your packages (pacman -Syu).

2. Point IntelliJ to the documentation

As mentioned above, the location of the JDK documentation for your project is configured in IntelliJ under Project Structure → Platform Settings → SDKs → Documentation Paths.

Add the path of the documentation you downloaded in the previous step.

If you downloaded it using pacman -S openjdk-doc, the location is

/usr/share/doc/java-openjdk

Generally, to get the files owned by a package, you can use

pacman -Q --list the-package-name

My configuration in IntelliJ now looks like this:

project structure screenshot

That's it. Displaying documentation of the Java standard library is now considerably faster because IntelliJ accesses local files.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
  • 1
    Also note that Quick Documentation can work on JDK sources if the URL is not specified in the Documentation Paths. This works out of the box. Documentation Paths configuration is needed for the External JavaDoc feature. – CrazyCoder Apr 21 '19 at 12:45