File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Including a jar file in your classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Including a jar file in your classpath" Watch "Including a jar file in your classpath" New topic
Author

Including a jar file in your classpath

Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
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).


John Bonham was stronger, but Keith Moon was faster.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
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


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
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


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Including a jar file in your classpath