Where to find Java JDK Source Code?
You haven't said which version you want, but an archive of the JDK 8 source code can be downloaded here, along with JDK 7 and JDK 6.
Additionally you can browse or clone the Mercurial repositories: 8, 7, 6.
Chances that you already got the source code with the JDK, it is matter of finding where it is. In case, JDK folder doesn't contain the source code:
sudo apt-get install openjdk-7-source
OSX Folks, search in homebrew formulas.
In ubuntu, the command above would put your souce file under: /usr/lib/jvm/openjdk-7/
Good news is that Eclipse will take you there already (How to bind Eclipse to the Java source code):
Follow the orange buttons
Sadly, as of this writing, DESPITE their own documentation readme, there is no src.zip in the JDK 7 or 8 install directories when you download the Windows version.
Note: perhaps this happens because many of us don't actually run the install .exe, but instead extract it. Many of us don't run the Java install (the full blown windows install) for security reasons....we just want the JDK put someplace out of the way where potential viruses cannot find it.
But their policy regarding the windows .exe (whatever it truly is) is indeed nuts, HOWEVER, the src.zip DOES exist in the linux install (a .tar.gz). There are multiple ways of extracting a .tar and a .gz, and I prefer the free "7Zip" utility.
- download the Linux 64 bit .tar.gz
- use 7zip to uncompress the .tar.gz to a .tar
- use 7zip to extract the .tar to the installation directory
- src.zip will be waiting for you in that installation directory.
- pull it out and place it where you like.
Oracle, this is really beyond stupid.