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$
jdk source code

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.

IntelliJ IDEA attach jdk source

2.3 Done.

References

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar