File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Displaying CLASSPATH's Values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Displaying CLASSPATH Watch "Displaying CLASSPATH New topic

Displaying CLASSPATH's Values

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
when we type path in command prompt, it would display path's values. i would like to have the Classpath display the same way and typed CLASSPATH in command prompt, it would say 'classpath' is not recognized as an internal or external command, operable program or batch file. can anyone explain me why? please also guide me through setting its value from command prompt and displaying back it's value from command prompt.

Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
@echo %classpath% for displaying claspath.
set classpath=%classpath%;yourClassPathString for setting the classpath.
Just typing the classpath at command prompt does not work. donno is it coz it is a user defined Environment variable ? anyone can add a comment on this ?

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
thanks Leena. by the way, are you a Dewan Rai?
i still don't know why just typing CLASSPATH in command prompt does not work!!!
Hartmut Ludwig
Ranch Hand

Joined: Aug 31, 2002
Posts: 51
I am acutally more surprised that entering "PATH" shows the PATH-Variable in Windows.
Usually the SET command (without parameters) is used to show environment variables. This works on any Windows OS as well as on Unix/Linux. I thought this is the only way.
I use "set PATH" and "set CLASSPATH" to display those values. If you just enter "set" you see them all.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
In Windoze, there is a command called PATH. There is also an environment variable called PATH. The command displays or changes the environment variable named PATH.
For more info, type this:
path /?
You can make an environment variable called CLASSPATH, but that is not the same as a command.
If you want to make such a command, create a classpath.cmd or classpath.bat file containing the code to do what you want, such as:
echo %classpath%

That classpath.bat file has to be somewhere in PATH

It's like the difference between fields and methods in java.
I agree. Here's the link:
subject: Displaying CLASSPATH's Values
It's not a secret anymore!