Just notic开发者_开发知识库ed that JDK contains src.zip
with a set of java files. I checked JRE and didn't found it over there.
Does it mean the JVM does not need these files in order to run my code?
The JDK (Java Development kit) is, as the name implies, a Development Kit, so it includes tools and resources that are useful for developers. Many of these tools or resources are not actually required in order to run Java applications. Specifically, src.zip
contains source code that is useful for developers, but indeed is not required to run Java applications.
The JRE (Java Runtime Environment), in contrast, includes only the JVM and tools and resources that are necessary in order to run Java applications.
So, in short, in order to run Java applications you only require the JRE. Anything in the JDK that is not present in the JRE is not required.
These files are here to provide the source of the JDK classes, this way, it's easier for developers how some classes act (but the javadoc should be sufficient).
So no, no need for clients to read the JDK source code. The only thing needed to run Java applications is the .jar containing all the .class for JDK Classes.
That's right, the JRE does not need Java source files to run your code.
The src.zip file includes the Java sources for the JDK library types and (apparently) some Sun JVM implementations of those types as well.
The JRE doesn't need your source files either, but the JDK includes a tool (javac) that compiles your sources to Java bytecode for execution on the JRE.
精彩评论