First of all. Oracle JDK is in essence OpenJDK because Oracle handed over (nearly) the whole stuff over to OpenJDK. Oracle JDK can be seen as one VM based on OpenJDK as there are others. What is stopping this month is the free availability of OracleJDK-updates, etc. but that has no effect on the other VMs out there.
The source can be accessed (including newer versions after Oracle stops their free support) at the Mercurial Repositories at http://hg.openjdk.java.net. The sources you're looking for should be available at http://hg.openjdk.java.net/jdk/jdk/tags
Edit: Because you asked in a later comment in your question: You can download the source of a given project by clicking onto one of the links on the left side of the page showing the names of archive-files (bz2, zip tar) at the start-page of a given tag.
Edit2: Because you asked for Java 1.8.0_192 (I assume b26), you can use http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/archive/996dd3ce1ec5.zip. Here are the steps to get to it: From the main page go to the Project jdk8u (http://hg.openjdk.java.net/jdk8u). Select jdk8u-dev->JDK (http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/). Click on "Tags" (http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/tags), select "jdk8u192-b26 " (http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/996dd3ce1ec5) and click on one of the archive-formats on the left, e.g. ZIP (see above).
Answer from Lothar on Stack OverflowCompilation of the Java 8 JDK source code with javac command line compiler - Stack Overflow
Where to get java JDK source code
Is "Where do I find the Java JDK Source code for JDK 1.8?" off-topic? - Meta Stack Overflow
Repository of Java 8 source code examples for learning
Example for Java 8:
sudo apt-get install openjdk-8-source
apt-get puts it under the relevant JDK location as src.zip: /usr/lib/jvm/java-8-openjdk-amd64/src.zip
Intellij IDEA recognized it automatically and started showing me the source code.
In case of java 11 (on Ubuntu 18.04) I did:
First I install jdk 11:
sudo apt install openjdk-11-jdk
I install the sources like this:
sudo apt-get install openjdk-11-source
And I found them in /usr/lib/jvm/openjdk-11/lib/src.zip
I use Eclipse so I go inside Eclipse's menu Window -> Preferences -> Installed JREs
and inside select
java-11-openjdk-amd64 -> edit -> select the jar (jrt-fs.jar) -> Source Attachment -> External location -> /usr/lib/jvm/openjdk-11/lib/src.zip
Now I happily read the java documentation! :)
Best of luck to all!
I am not new to Java when it comes to programming but I am very interested lately to see implementation wise how some of the constructs I use everyday are implemented. But besides from what I learnt googling online, I was wondering if you can actually download the source code for the JDK and view them.
Quoting help/on-topic (emphasis is mine in both quotes):
- software tools commonly used by programmers; and is
- a practical, answerable problem that is unique to software development
Finding the source of the JDK is exactly the close reason of your question:
"Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow..."
The answers can't give more than an external resource or guidance to get an external resource, which is likely to break at any point in time. This is exactly why 'off-site' resources are off topic on SO.
Regarding the edit:
The reason for the edit (Rev. 6, Rollback to Rev. 4) was that your edit (Rev. 5) did nothing but introduce a ton of noise (noise = unnecessary information etc.).
If the community consensus is "OFF-TOPIC", you shouldn't add text to your question explaining why it should be reopened. Instead, you should post a question on meta, or explain it via comments.