Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying CLASSPATH's Values

 
Himal Chuli
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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.
thanks.
himal
 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@echo %classpath% for displaying claspath.
set classpath=%classpath%;yourClassPathString for setting the classpath.
Just typing the classpath at command prompt does not work. donno why..umm..er.. is it coz it is a user defined Environment variable ? anyone can add a comment on this ?
Leena
 
Himal Chuli
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
himal
 
Hartmut Ludwig
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm.
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.
sl
Hartmut
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic