The Classpath

suggest change

Introduction

The classpath lists places where the Java runtime should look for classes and resources. The classpath is also used by the Java compiler to find previously compiled and external dependencies.

Remarks

Java class loading

The JVM (Java Virtual Machine) will load classes as and when the classes are required (this is called lazy-loading). Locations of the classes to be used are specified in three places:-

  1. Those required by the Java Platform are loaded first, such as those in the Java Class Library and it’s dependencies.
  2. Extension classes are loaded next (i.e. those in jre/lib/ext/)
  3. User-defined classes via the classpath are then loaded

Classes are loaded using classes that are subtypes of java.lang.ClassLoader. This described in a more detail in this Topic: http://stackoverflow.com/documentation/java/5443/classloaders.

Classpath

The classpath is a parameter used by the JVM or compiler which specifies the locations of user-defined classes and packages. This can be set in the command line as with most of these examples or through an environmental variable (CLASSPATH)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


The Classpath:
* The Classpath

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
84 The Classpath
89 JAX-WS
96 XJC
98 Process
106 Modules
114 Applets
122 JNDI
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap