Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting the class path

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

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

in --
set classpath=%classpath%


thanks,

vinay rajnish
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic