How to attach JDK source code to IntelliJ IDEA?
In this article, we will show you how to attach the JDK source code into the IntelliJ IDEA? By default, IntelliJ IDEA doesn’t come with JDK source code, and the auto decompile feature is useful; however, we still need to jump in the source code to read the source code comments or docs to understand more about the API usage.
1. Where is JDK Source Code?
1.1 Usually, the JDK source code is named src.zip
, and located at the root folder of the JDK installed path.
For example:
terminal
$ /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64$
2. Add the src.zip to IntelliJ IDEA
2.1 File -> Project Structure
2.2 Platform Settings -> SDKs -> Select Sourcepath
-> plus icon -> select src.zip
from the JDK installed path.
2.3 Done.
Thanks a lot, it helped me.