• Post Reply Bookmark Topic Watch Topic
  • New Topic

setting the class path  RSS feed

 
vianyrajnish rajnish
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

can you please tell me the meaning of this %classpath%

in --
set classpath=%classpath%


thanks,

vinay rajnish
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CLASSPATH (preferably in capital letters) is an environment which holds a value comprising of one or set of locations on a physical file system each separted by the OS specific path separator.

The classpath variable is used when compiling a .java file which may in turn make use of the classes available either directly or inside the archive (jar) file present in any of the classpath locations.

Hope this helps!
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
%classpath% represents the current value of the classpath variable, so
set classpath=%classpath%
just sets the variable to it's current value. Where it is more useful is if you want to add another directory/jar file to your classpath.

So if your current classpath is
jar1.jar;jar2.jar;jar3.jar;jar4.jar;jar5.jar
then typing
set classpath=%classpath%;newjar.jar
will change the value to
jar1.jar;jar2.jar;jar3.jar;jar4.jar;jar5.jar;newjar.jar
 
Mohammad Hossain
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know
when you use javac or java they search for files in the directories that are in '$classspath' variable. Thats why before you use javac you need to make sure that the directory containing the java file is in your classpath.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!