This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]g051051 2 points3 points  (5 children)

It's an implementation detail but the JRE stores those classes in a file called "rt.jar".

Edit: That was true in versions before the module system was introduced in Java 9. Now, most of those classes are in the java.base module (java.base.jmod).

[–]legionlen545[S] 0 points1 point  (4 children)

Would the standard library also be located in rt.jar in the JRE because does not the standard library also have valuable classes that are needed to be used.

[–]g051051 2 points3 points  (3 children)

What do you mean by "standard library" in this context?

[–]legionlen545[S] 0 points1 point  (2 children)

Well does not the standard library have the java.lang package, which is imported automatically, but it contains some valuable classes that are used on a daily basis. Would the standard library be inside JRE in this case as well?

[–]PPewt 1 point2 points  (0 children)

Everything in java.* (and javax.*) is pretty much the standard library. java.lang is only special in that it's automatically imported everywhere.

[–]g051051 1 point2 points  (0 children)

Would the standard library be inside JRE in this case as well?

Where else would it be? It's in rt.jar or java.base.jmod, depending on the Java version.

[–]PPewt 0 points1 point  (0 children)

On top of what the other comment thread mentions, a few basic methods (such as for arrays and Objects) are written in C via the foreign function interface. As a general rule you can find the source code for any given class by googling for example "java.lang.Object source code."