<s>
Classpath	B-Language
is	O
a	O
parameter	O
in	O
the	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
or	O
the	O
Java	B-Language
compiler	I-Language
that	O
specifies	O
the	O
location	O
of	O
user-defined	O
classes	O
and	O
packages	B-Language
.	O
</s>
<s>
The	O
parameter	O
may	O
be	O
set	O
either	O
on	O
the	O
command-line	B-Application
,	O
or	O
through	O
an	O
environment	O
variable	O
.	O
</s>
<s>
Similar	O
to	O
the	O
classic	O
dynamic	O
loading	O
behavior	O
,	O
when	O
executing	O
Java	B-Device
programs	O
,	O
the	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
finds	O
and	O
loads	O
classes	O
lazily	O
(	O
it	O
loads	O
the	O
bytecode	B-Language
of	O
a	O
class	O
only	O
when	O
the	O
class	O
is	O
first	O
used	O
)	O
.	O
</s>
<s>
The	O
classpath	B-Language
tells	O
Java	B-Device
where	O
to	O
look	O
in	O
the	O
filesystem	O
for	O
files	O
defining	O
these	O
classes	O
.	O
</s>
<s>
bootstrap	O
classes	O
:	O
the	O
classes	O
that	O
are	O
fundamental	O
to	O
the	O
Java	B-Device
Platform	I-Device
(	O
comprising	O
the	O
public	O
classes	O
of	O
the	O
Java	B-Library
Class	I-Library
Library	I-Library
,	O
and	O
the	O
private	O
classes	O
that	O
are	O
necessary	O
for	O
this	O
library	O
to	O
be	O
functional	O
)	O
.	O
</s>
<s>
By	O
default	O
only	O
the	O
packages	B-Language
of	O
the	O
JDK	B-Language
standard	B-Language
API	I-Language
and	O
extension	O
packages	B-Language
are	O
accessible	O
without	O
needing	O
to	O
set	O
where	O
to	O
find	O
them	O
.	O
</s>
<s>
The	O
path	O
for	O
all	O
user-defined	O
packages	B-Language
and	O
libraries	O
must	O
be	O
set	O
in	O
the	O
command-line	B-Application
(	O
or	O
in	O
the	O
Manifest	O
associated	O
with	O
the	O
Jar	B-Language
file	I-Language
containing	O
the	O
classes	O
)	O
.	O
</s>
<s>
and	O
the	O
files	O
defining	O
this	O
package	O
are	O
stored	O
physically	O
under	O
the	O
directory	O
D:\myprogram	O
(	O
on	O
Windows	B-Application
)	O
or	O
/home/user/myprogram	O
(	O
on	O
Linux	B-Application
)	O
.	O
</s>
<s>
When	O
we	O
invoke	O
Java	B-Device
,	O
we	O
specify	O
the	O
name	O
of	O
the	O
application	O
to	O
run	O
:	O
org.mypackage.HelloWorld	O
.	O
</s>
<s>
However	O
we	O
must	O
also	O
tell	O
Java	B-Device
where	O
to	O
look	O
for	O
the	O
files	O
and	O
directories	O
defining	O
our	O
package	O
.	O
</s>
<s>
The	O
environment	O
variable	O
named	O
CLASSPATH	B-Language
may	O
be	O
alternatively	O
used	O
to	O
set	O
the	O
classpath	B-Language
.	O
</s>
<s>
For	O
the	O
above	O
example	O
,	O
we	O
could	O
also	O
use	O
on	O
Windows	B-Application
:	O
</s>
<s>
The	O
rule	O
is	O
that	O
-classpath	O
option	O
,	O
when	O
used	O
to	O
start	O
the	O
java	B-Device
application	O
,	O
overrides	O
the	O
CLASSPATH	B-Language
environment	O
variable	O
.	O
</s>
<s>
If	O
none	O
are	O
specified	O
,	O
the	O
current	B-Application
working	I-Application
directory	I-Application
is	O
used	O
as	O
classpath	B-Language
.	O
</s>
<s>
This	O
means	O
that	O
when	O
our	O
working	B-Application
directory	I-Application
is	O
D:\myprogram\	O
(	O
on	O
Linux	B-Application
,	O
/home/user/myprogram/	O
)	O
,	O
we	O
would	O
not	O
need	O
to	O
specify	O
the	O
classpath	B-Language
explicitly	O
.	O
</s>
<s>
into	O
the	O
classpath	B-Language
in	O
the	O
case	O
when	O
loading	O
classes	O
from	O
current	O
folder	O
is	O
desired	O
.	O
</s>
<s>
The	O
same	O
applies	O
not	O
only	O
to	O
java	B-Device
launcher	O
but	O
also	O
to	O
javac	B-General_Concept
,	O
the	O
java	B-Language
compiler	I-Language
.	O
</s>
<s>
If	O
a	O
program	O
uses	O
a	O
supporting	O
library	O
enclosed	O
in	O
a	O
Jar	B-Language
file	I-Language
called	O
supportLib.jar	O
,	O
physically	O
located	O
in	O
the	O
directory	O
D:\myprogram\lib\	O
and	O
the	O
corresponding	O
physical	O
file	O
structure	O
is	O
:	O
</s>
<s>
the	O
following	O
command-line	B-Application
option	O
is	O
needed	O
:	O
</s>
<s>
In	O
Java	B-Device
6	O
and	O
higher	O
,	O
one	O
can	O
add	O
all	O
jar-files	B-Language
in	O
a	O
specific	O
directory	O
to	O
the	O
classpath	B-Language
using	O
wildcard	O
notation	O
.	O
</s>
<s>
Windows	B-Application
example	O
:	O
</s>
<s>
Linux	B-Application
example	O
:	O
</s>
<s>
This	O
works	O
for	O
both	O
-classpath	O
options	O
and	O
environment	O
classpaths	B-Language
.	O
</s>
<s>
If	O
a	O
program	O
has	O
been	O
enclosed	O
in	O
a	O
Jar	B-Language
file	I-Language
called	O
helloWorld.jar	O
,	O
located	O
directly	O
in	O
the	O
directory	O
D:\myprogram,	O
the	O
directory	O
structure	O
is	O
as	O
follows	O
:	O
</s>
<s>
The	O
manifest	O
file	O
defined	O
in	O
helloWorld.jar	O
has	O
this	O
definition	O
:	O
</s>
<s>
Class-Path	O
describes	O
the	O
location	O
of	O
supportLib.jar	O
relative	O
to	O
the	O
location	O
of	O
the	O
library	O
helloWorld.jar	O
.	O
</s>
<s>
Neither	O
absolute	O
file	O
path	O
,	O
which	O
is	O
permitted	O
in	O
parameter	O
on	O
the	O
command	B-Application
line	I-Application
,	O
nor	O
jar-internal	O
paths	O
are	O
supported	O
.	O
</s>
<s>
This	O
means	O
that	O
if	O
the	O
main	O
class	O
file	O
is	O
contained	O
in	O
a	O
jar	B-Language
,	O
org/mypackage/HelloWorld.class	O
must	O
be	O
a	O
valid	O
path	O
on	O
the	O
root	O
within	O
the	O
jar	B-Language
.	O
</s>
<s>
Multiple	O
classpath	B-Language
entries	O
are	O
separated	O
with	O
spaces	O
:	O
</s>
<s>
Being	O
closely	O
associated	O
with	O
the	O
file	O
system	O
,	O
the	O
command-line	B-Application
Classpath	B-Language
syntax	O
depends	O
on	O
the	O
operating	O
system	O
.	O
</s>
<s>
on	O
all	O
Unix-like	B-Application
operating	O
systems	O
(	O
such	O
as	O
Linux	B-Application
and	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
)	O
,	O
the	O
directory	O
structure	O
has	O
a	O
Unix	B-Application
syntax	O
,	O
with	O
separate	O
file	O
paths	O
separated	O
by	O
a	O
colon	O
(	O
 "	O
:	O
"	O
)	O
.	O
</s>
<s>
on	O
Windows	B-Application
,	O
the	O
directory	O
structure	O
has	O
a	O
Windows	B-Application
syntax	O
,	O
and	O
each	O
file	O
path	O
must	O
be	O
separated	O
by	O
a	O
semicolon	O
(";	O
"	O
)	O
.	O
</s>
<s>
This	O
does	O
not	O
apply	O
when	O
the	O
Classpath	B-Language
is	O
defined	O
in	O
manifest	O
files	O
,	O
where	O
each	O
file	O
path	O
must	O
be	O
separated	O
by	O
a	O
space	O
(""	O
)	O
,	O
regardless	O
of	O
the	O
operating	O
system	O
.	O
</s>
