• 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

Including a jar file in your classpath

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really silly question folks, sorry about this.
How do I include a jar file in my classpath?
I'm using a PC running Windows 98 (second edition).
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SET CLASSPATH=C:\ADIRECTORY\ajarfile.jar;%CLASSPATH%
You would probably need to do that in your C:\AUTOEXEC.BAT file and then reboot the machine.
The %CLASSPATH% tells the system to put the "old" or "previous" value of the CLASSPATH at the end of the new CLASSPATH. If there was no previous CLASSPATH you can use SET CLASSPATH=C:\ADIRECTORY\ajarfile.jar;.
Note the semicolon and period at the end!
-Barry
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Steve,
You can just drop a copy of the jar in your jre/lib/ext directory or you can append the fully qualified name to your CLASSPATH envrionment variable (eg C:\MyJars\MyClasses.jar) or you can build a classpath on most of the java utilities (like javac, java, etc.) with a -classpath flag like this:
javac -classpath .;C:\MyJars\MyClasses.jar source.java
Hope this helps,
Michael Morris
reply
    Bookmark Topic Watch Topic
  • New Topic