IntelliJ IDEA
JavaDoc
Programming
Java Development
IDE Tools

How to see JavaDoc in IntelliJ IDEA?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

IntelliJ IDEA by JetBrains is one of the most popular Integrated Development Environments (IDEs) used by Java developers. It is designed to maximize developer productivity by automating routine checks and corrections, and by providing a rich set of tools. One of its most valuable features is its ability to integrate and display JavaDoc, which is crucial for understanding the functionality of different classes, methods, and libraries.

Accessing JavaDoc in IntelliJ IDEA

JavaDoc comments are specially formatted comments that are written in the Java source files and can be compiled into a web-accessible format that serves as documentation. IntelliJ IDEA makes it simple to view this important documentation directly in the IDE, enhancing code understanding and ensuring correct API usage.

Hover Feature

The simplest way to view JavaDoc in IntelliJ IDEA is by hovering over any class, method, or variable while holding the Ctrl key (Cmd on macOS). A popup appears that shows the relevant JavaDoc, assuming it exists. This feature is convenient for quickly looking up the documentation without interrupting the coding workflow.

JavaDoc Tool Window

For a more in-depth look at documentation, IntelliJ has a JavaDoc tool window. Here’s how you can access it:

  1. Navigate to View > Tool Windows > Documentation or simply press Ctrl + Q (Cmd + Q on macOS).
  2. This command brings up the JavaDoc for the item at the cursor in a separate window pane at the bottom or side of the IDE.
  3. If additional browsing is needed, you can use the buttons in the top bar of the JavaDoc window to go back and forward through your JavaDoc “history”.

In-line Documentation

If you prefer to see JavaDoc without switching context, IntelliJ IDEA offers an inline documentation view:

  • Place the cursor on the element you want to understand.
  • Either click View > Quick Documentation or just press Ctrl + Q (Cmd + Q on macOS).
  • A popup window appears containing the JavaDoc, which remains as long as the shortcut is held. If you press Ctrl + Q twice, this window becomes a floating window which you can move and resize as needed.

Configuring JavaDoc Settings

To optimize how JavaDoc is displayed or which particular pieces of documentation are shown, you can tweak IntelliJ IDEA’s settings:

  • Go to File > Settings (or IntelliJ IDEA > Preferences on macOS).
  • In the settings window, navigate to Editor > General > Code Completion.
  • Adjust the JavaDoc settings under the ‘Show the documentation popup in’ section.

Here, you can choose how quickly the JavaDoc popup appears when you hover over code elements.

Generating JavaDoc

IntelliJ IDEA also allows developers to generate JavaDoc for their own code:

  1. Select the project, package, or file for which you wish to generate JavaDoc.
  2. Go to Tools > ‘Generate JavaDoc’.
  3. A dialog will appear where you can configure the scope, output format, and output directory among other settings.

Summary Table

FeatureShortcut / PathDescription
Quick documentation popupCtrl + Q (Cmd + Q)Show the JavaDoc for selected element
Documentation tool windowView > Tool WindowsOpens detailed JavaDoc in tool window
Hover JavaDocHold Ctrl (Cmd)Shows a tooltip with brief JavaDoc
Generate JavaDocTools > Generate JavaDocAllows you to create JavaDoc for your project

Conclusion

IntelliJ IDEA provides a robust platform for managing JavaDoc, making it accessible just at the point of need and greatly improving developer productivity by keeping necessary information easily reachable. Whether through hover, pop-ups, or dedicated windows, IntelliJ IDEA’s JavaDoc integration ensures that developers spend less time searching for documentation and more time coding effectively.


Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.