1

After downloading openJDK from here, I found a src.zip folder under lib directory. This zipped file holds Java API implementations.

enter image description here

After unzipping this file, I do find a lot of familiar names. After running the following script in Python, it turns out there are 17733 .java files.

import pathlib

print(len(list(pathlib.Path(".").rglob("*.java"))))

Now I am wondering if there is any possibility I could compile these .java files into .class using javac to inspect their corresponding binaries.

enter image description here

A similar post is here but I do not think it resolve my confusion.

Mr.Robot
  • 349
  • 1
  • 16
  • If you want to build Java yourself, it's what is currently the second answer to that question you should read: https://stackoverflow.com/a/4949041/5221149. The `src.zip` file doesn't have all the source files, so it won't compile. Get all the source files and build scripts from the OpenJDK project. – Andreas Jan 22 '21 at 17:43
  • 1
    @Andreas you know that the JDK, the OP downloaded, *is* OpenJDK? Or in other words, you’ve linked to an answer that links to a page that links to the same download page the OP has used. – Holger Jan 22 '21 at 19:37
  • @Holger I know that the JDK that OP downloaded is a "build", i.e. the binary installable, not the source code with build scripts. I know that the link at the top of the question is for the "build" downloads, and that the answer I linked to has a link to the source. Not the same download page at all. Sure, the "build" download page also has a link to the source download page, but that's not what OP used. – Andreas Jan 23 '21 at 00:21
  • 1
    @Andreas just consider that a decade old wisdom (“The src.zip file doesn't have all the source files”) might be outdated. It was true for Oracle’s closed source JDK 6, but does not apply to the open source OpenJDK 15. So compiling those java files into class files (this is what the OP asked for) *is* possible. It’s not possible to regenerate automatically created source files or adapt the JDK to a different platform, though. – Holger Jan 25 '21 at 09:16

0 Answers0