Vicky
Vicky

Reputation: 11227

Where are the class files located in JDK folder?

This may sound like a stupid question. Where are the core class files from Sun, like Button.class, located in the JDK installation folder C:\Program Files\Java\jdk1.5.0_12?

Or do the class files reside in C:\Program Files\Java\jre1.5.0_12 folder?

Upvotes: 3

Views: 15861

Answers (5)

Dennis
Dennis

Reputation: 177

There are actually contained in the JRE. Although, the JDK have her copy of the JRE so we may be tempted to say both JDK and JRE but in reality java inbuild classes are contained in the JRE.

Upvotes: 0

ramasamyz
ramasamyz

Reputation: 43

You can check out yourself for any class through reflection.

For example where can I find my String class located in the classpath? Easy

URL url = String.class.getResource("String.class");
System.out.println(url);

Upvotes: 0

OscarRyz
OscarRyz

Reputation: 199215

On Both.

They are two different JVM's installations. One used to compile ( JDK stands for Java Development Kit ) and the other is the java environment which most customers machine have ( JRE stands for Java Runtime Environment )

Look on any of those two for a file named:

rt.jar

That where the core of the platform resides.

Upvotes: 0

Uri
Uri

Reputation: 89729

The class files actually reside as jar files inside the Java distribution being used. Most files are in rt.jar (runtime).

Most developer machines actually have two forms of Java installed. The JDK (which you would often be using when developing and includes the compiler), and the JRE which is used by downloaded Java based applications, and often your web browser. Those are typically two independent distributions that don't know about each other. So the answer to your question is unfortunately, "depending what it is that you are running". To make things worse, the JDK may include it's own copy of the JRE...

This is one of the sources of the so-called classpath hell, because it is not always clear what you are using when you are running a java program.

If you run java from the command line, you can sometimes detect the exact version being used.

If you use Eclipse, you can pick version of the JDK you are working with.

Upvotes: 2

Cheese Daneish
Cheese Daneish

Reputation: 1030

They are spread between several jars. It looks like Button is in jre/lib/rt.jar though.

Upvotes: 3

Related Questions