• 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

java -classpath option

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

could anyone of you give me an example how to use
javac -classpath


i don;t know how to use it

pls help

thanks
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Beny,

Assuming myjar.jar is in c:\jardir and Engine.class in c:\classdir, and those files are needed in order for Car.java to compile successfully. So you use "classpath" option to tell the compiler where to look for those files. Car.java is stored in c:\workarea directory.



For Windows, use semicolons to separate the classpath as shown in the example above; for Solaris, use colons. For more info, see Windows: classpath and Solaris: classpath.

There are some rules you need to follow when setting the classpath.
Quote from Solaris: classpath (same for Windows):

  • For a .jar or .zip file that contains .class files, the class path ends with the name of the .zip or .jar file.
  • For .class files in an unnamed package, the class path ends with the directory that contains the .class files.
  • For .class files in a named package, the class path ends with the directory that contains the "root" package (the first package in the full package name).

  • Joyce
    [ July 14, 2005: Message edited by: Joyce Lee ]
     
    Beny Na
    Ranch Hand
    Posts: 159
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Nice Reply...

    thanks a lot Joyce
     
    reply
      Bookmark Topic Watch Topic
    • New Topic