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 Referencing Jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Referencing Jar files" Watch "Referencing Jar files" New topic
Author

Referencing Jar files

Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
Hi

I extracted a .zip file to the same folder where my java files reside.
The zip extracted is a folder containing jar files located at
httpcomponents-client-4.0-alpha2\lib

javac currently shows package-not-found errors when I try to import
import org.apache.commons.httpclient.Cookie;
How do I get it to recognize those 4 jars ?

Thanks


Anjanesh Lekshminarayanan
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

You need to add httpcomponents-client-4.0-alpha2\lib to your CLASSPATH when you compile

e.g. javac -cp .\httpcomponents-client-4.0-alpha2\lib\NameOfYourJARFile.jar *.java

Cheers,
Martijn

[ December 12, 2007: Message edited by: Martijn Verburg ]
[ December 12, 2007: Message edited by: Martijn Verburg ]

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
Still didnt work.
But giving the full jar name worked.

javac -classpath httpcomponents-client-4.0-alpha2/lib/httpcore-4.0-alpha6.jar myProg.java
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Referencing Jar files
 
Similar Threads
Problem while uploading an image using UploadBean
Can't run/import a downloaded applet
Getting Invalid Package Error while connecting to Oracle
PDFBox und Lucene in Eclipse und Netbeans
POI