Stardust
Stardust

Reputation: 1115

Confusion in understanding classpath

I'm confused in understanding, how java interpretor and java compiler searches for all the necessary jar files it requires from environment variables. As I have only set the set path variable for JDK directory, but I've not set any variable to search for any class libraries, which jvm requires. How can it search those important jar files?

Upvotes: 2

Views: 860

Answers (3)

Chandra Sekar
Chandra Sekar

Reputation: 10843

For better understanding of how classes are found and loaded by JVM read How Classes are Found.

Upvotes: 2

Jon Skeet
Jon Skeet

Reputation: 1499760

Which jar files are you talking about? Java already knows about the jar files it "owns" (such as rt.jar) - you don't have to tell it about them explicitly. This is known as the bootclasspath - you can override it, but usually you don't want to.

Upvotes: 5

Thirler
Thirler

Reputation: 20760

CLASSPATH is an enviromental variable is like the path file (which helps windows to find executables). It lists a set of all places the JVM looks for classes. You can also give the classpath on the command line when starting the jvm and java compiler

Upvotes: 1

Related Questions