âšī¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.1 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://introcs.cs.princeton.edu/java/15inout/classpath.html |
| Last Crawled | 2026-04-14 14:28:48 (3 days ago) |
| First Indexed | not set |
| HTTP Status Code | 200 |
| Meta Title | Setting the Classpath in Java |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | This page is obsolete.
To use our standard library files (
StdDraw.java
,
StdIn.java
, and
StdOut.java
),
you can place them in the same directory as the main program you are writing.
A drawback with this is approach is that you end up with many copies of the same library files,
scattered in different directories.
Java's
classpath
mechanism allows you to store and access
the library files from a common directory.
Organizing the Shared Libraries
Place the shared library files (
StdDraw.java
,
StdIn.java
, and
StdOut.java
)
in a commond directory, say
C:\introcs
. Go to that directory and compile them.
Setting the Classpath in DrJava
To set the classpath for DrJava:
From DrJava, choose the menu option
Edit -> Preferences -> Resource Locations -> Extra Classpath -> Add
and select
C:\introcs
. Click the
Apply
button, then
the
OK
button.
Setting the Classpath for the Windows Command Prompt
To set the classpath for the Windows XP Command Prompt:
Select
Start -> Control Panel -> System -> Advanced -> Environment Variables -> System Variables -> CLASSPATH
.
If the Classpath variable exists, prepend
.;C:\introcs
to the
beginning
of the
CLASSPATH
varible.
If the
CLASSPATH
variable does not exist, select
New
. Type
CLASSPATH
for the variable name and
.;C:\introcs
for the variable value.
Click OK three times.
Setting the Classpath in OS X
To set the classpath for the bash shell in OS X:
Use your favorite text editor (e.g., TextEdit)
to add the following line to the file
/Users/username/.bashrc
.
export CLASSPATH=.:/Users/username/introcs/
If the file doesn't exist, create a new one.
Close the Terminal and open a new one.
If it does not work, in addition, try repeating the same instructions
with the file
/Users/username/.profile
or
/Users/username/.bash_profile
.
Troubleshooting
Here are a few suggestions that might help correct any installation
woes you are experiencing. If you need assistance, don't hesitate
to contact a staff member.
How can I check the value of my
CLASSPATH
variable?
Windows Command Prompt
Type the following at the command prompt.
C:\introcs\hello\>
echo %CLASSPATH%
The
CLASSPATH
variable should begin with
.;C:\introcs
.
OS X and Linux
Type the following at the shell.
echo $CLASSPATH |
| Markdown | ## Setting the Classpath in Java
This page is obsolete.
To use our standard library files (StdDraw.java, StdIn.java, and StdOut.java), you can place them in the same directory as the main program you are writing. A drawback with this is approach is that you end up with many copies of the same library files, scattered in different directories. Java's *classpath* mechanism allows you to store and access the library files from a common directory.
| |
|---|
| Organizing the Shared Libraries |
Place the shared library files (StdDraw.java, StdIn.java, and StdOut.java) in a commond directory, say C:\\introcs. Go to that directory and compile them.
| |
|---|
| Setting the Classpath in DrJava |
To set the classpath for DrJava:
- From DrJava, choose the menu option *Edit -\> Preferences -\> Resource Locations -\> Extra Classpath -\> Add* and select
C:\\introcs
. Click the *Apply* button, then the *OK* button.
| |
|---|
| Setting the Classpath for the Windows Command Prompt |
To set the classpath for the Windows XP Command Prompt:
- Select *Start -\> Control Panel -\> System -\> Advanced -\> Environment Variables -\> System Variables -\> CLASSPATH*.
- If the Classpath variable exists, prepend **.;C:\\introcs** to the *beginning* of the
CLASSPATH
varible.
- If the
CLASSPATH
variable does not exist, select *New*. Type **CLASSPATH** for the variable name and **.;C:\\introcs** for the variable value.
- Click OK three times.
| |
|---|
| Setting the Classpath in OS X |
To set the classpath for the bash shell in OS X:
- Use your favorite text editor (e.g., TextEdit) to add the following line to the file
/Users/username/.bashrc
.
> ```
> export CLASSPATH=.:/Users/username/introcs/
> ```
If the file doesn't exist, create a new one.
- Close the Terminal and open a new one. If it does not work, in addition, try repeating the same instructions with the file
/Users/username/.profile
or
/Users/username/.bash\_profile
.
| |
|---|
| Troubleshooting |
Here are a few suggestions that might help correct any installation woes you are experiencing. If you need assistance, don't hesitate to contact a staff member.
**How can I check the value of my CLASSPATH variable?**
- *Windows Command Prompt* Type the following at the command prompt.
> ```
> C:\introcs\hello\> echo %CLASSPATH%
> ```
The
CLASSPATH
variable should begin with
.;C:\\introcs
.
- *OS X and Linux* Type the following at the shell.
> ```
> echo $CLASSPATH
> ``` |
| Readable Markdown | This page is obsolete.
To use our standard library files (StdDraw.java, StdIn.java, and StdOut.java), you can place them in the same directory as the main program you are writing. A drawback with this is approach is that you end up with many copies of the same library files, scattered in different directories. Java's *classpath* mechanism allows you to store and access the library files from a common directory.
Organizing the Shared Libraries
Place the shared library files (StdDraw.java, StdIn.java, and StdOut.java) in a commond directory, say C:\\introcs. Go to that directory and compile them.
Setting the Classpath in DrJava
To set the classpath for DrJava:
- From DrJava, choose the menu option *Edit -\> Preferences -\> Resource Locations -\> Extra Classpath -\> Add* and select
C:\\introcs
. Click the *Apply* button, then the *OK* button.
Setting the Classpath for the Windows Command Prompt
To set the classpath for the Windows XP Command Prompt:
- Select *Start -\> Control Panel -\> System -\> Advanced -\> Environment Variables -\> System Variables -\> CLASSPATH*.
- If the Classpath variable exists, prepend **.;C:\\introcs** to the *beginning* of the
CLASSPATH
varible.
- If the
CLASSPATH
variable does not exist, select *New*. Type **CLASSPATH** for the variable name and **.;C:\\introcs** for the variable value.
- Click OK three times.
Setting the Classpath in OS X
To set the classpath for the bash shell in OS X:
- Use your favorite text editor (e.g., TextEdit) to add the following line to the file
/Users/username/.bashrc
.
> ```
> export CLASSPATH=.:/Users/username/introcs/
> ```
If the file doesn't exist, create a new one.
- Close the Terminal and open a new one. If it does not work, in addition, try repeating the same instructions with the file
/Users/username/.profile
or
/Users/username/.bash\_profile
.
Troubleshooting
Here are a few suggestions that might help correct any installation woes you are experiencing. If you need assistance, don't hesitate to contact a staff member.
**How can I check the value of my CLASSPATH variable?**
- *Windows Command Prompt* Type the following at the command prompt.
> ```
> C:\introcs\hello\> echo %CLASSPATH%
> ```
The
CLASSPATH
variable should begin with
.;C:\\introcs
.
- *OS X and Linux* Type the following at the shell.
> ```
> echo $CLASSPATH
> ``` |
| Shard | 115 (laksa) |
| Root Hash | 2949492391842740915 |
| Unparsed URL | edu,princeton!cs,introcs,/java/15inout/classpath.html s443 |