Where to download servlet.jar

Hi,everybody

developing servlet,it need to download two java servlet package(javax.servlet and java.servlet.http) from http://java.sun.com/products/servlet/download.html and then Unzip the downloaded class file in the computer,but to which directoryI must unzip the file,in the other hand,after I unzip the downloaded file in my computer,I have not found the servlet.jar document,how and where can I get the servlet.jar document,and how to install it and to set system variable in order to solve the problem that system can not find the package javax.servlet.http.* when I complie a java file using javac.

thank for your kind attention,please reply.

[668 byte] By [Devemora] at [2007-10-3 9:18:51]
# 1

Hi Devemor !

Installing J2EE may be an overkill

If you have other needs for J2EE, that is probably the best way to go. However, if you are solely interested in the classes for the javax.servlet and javax.servlet.http packages, downloading and installing J2EE is probably overkill. Since I don't currently have any other need for J2EE, I elected the second option.

Download and install the two servlet packages

Here is what I did:

* Download and save the file named servletapi2_1_1-win.zip from the bottom of the web page at http://java.sun.com/products/servlet/archive.html.

* Create a folder in the root directory of my C-drive named JavaServlet2.1.1.

* Extract the contents of the zip file into the new folder. The most important item extracted is a file named servlet.jar, which contains the servlet packages. In addition, there is a folder named api, which contains standard documentation for the packages. Also included, but of little interest to me, is a folder named src, apparently containing the source code for all the files in the package.

* Create a desktop shortcut to the file named index.html in the api folder to make the documentation readily available.

* Add the following environment variable to make the servlet classes available to the Java compiler and the Java virtual machine:

CLASSPATH=c:\JavaServlet2.1.1\servlet.jar;.

(Don't forget the period on the end, which makes it possible to find class files in the current directory. If you already have a CLASSPATH environment variable, don't replace it, update it.)

Once again, unless I left something out, if you follow these instructions, you should be ready at this point to write, compile, and deploy a simple servlet and a simple JSP document on the Tomcat servlet/JSP container.

Refer this website: http://www.dickbaldwin.com/java/Java679.htm

Regards

Prasann.B

Prasua at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
hi :-)set you classpath when compiling your java file :-)regards,
jie2eea at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Hi!The contents i have posted are actually contained in this website http://www.dickbaldwin.com/java/Java679.htm(Refer this)RegardsPrasanna.B
Prasua at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi,PrasuThank you very much,you answer me question so quickly and detailly,I will follow instruction in the reply to continue my studying program in Jsp/servlet.RegardsDevemor
Devemora at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Hi Prasu,

I have followed the instructions of your replying,however I have not solve the problem.I whether it is because that I have installed another software which is bundled with Tomcat,therefore,the system variable of CATALINA_HOME AND CATALINA_BASE are conflict with Apache Tomcat which I installed it in another directory,it is because of this reason,Can you tell me the mothod to solve it.

thank you for your kind attention,please reply.

Regards

Devemora at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Hi!If u installed in C:\JavaServlet2.1.1To complie the servletDrive:\wherer your servlet -program reside \ javac .;classpath C:\JavaServlet2.1.1\servlet.jar ServletProgram.javayou can compile your servlet in this wayRegardsPrasanna.B
Prasua at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

Hi!

For example if u contain your servlet program in(FirstServlet.java)

D:\ServletProgramExamples\

Consider you have jdk1.5.0_08(C:\jdk1.5.0_08)

Setting path for jdk

D:\ServletProgramExamples> set path=C:\jdk1.5.0_08\bin

After that setting classpath to compile the servlet

D:\ServletProgramExamples>javac -classpath .;C:\JavaServlet2.1.1\servlet.jar

FirstServlet.java

I think u are clear now

Regards

Prasanna.B

Prasua at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
Hifor TOMACAT s/w instalation we need to set variables of CATALINA_HOME & JAVA_HOME .naveen.m
java_marthona at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
Hi Prasu thank for your helping,I have complie the java file of servlet in the way you wrote,but there also contain the problem.Does it concern with the version of the downloaded servlet package?and thank for kind attention of everybody.RegardsDevemor
Devemora at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10

Hi,Prasu. Thank you for your recommending URL,accessing to the Website and navigating to www.coreservlets.com,I followed the instructions on the webpage,I have solved the problem.when I copy the HelloServlet.class compiled HelloServlet.java file to the directory of

Tomcat install_dir/webapps/ROOT/WEB-INF/classes,however,afer I click on the URL of localhost/servlet/HelloServlet,it pop-up a error message writing that the HTTP Request Sevlet resource is not available,how can I correct this bug.The CLASSPATH variable and other setting is correct.

Thank for everybody attention.

Regards

Devemor

Devemora at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11

Hi Devemor !

Did u check with any sample servlets(like hello world!)

Did u got the home page of tomcat while running http://localhost/

Try to post the code, and specify what exception you are getting.

if u get (404 exception) the requested file is not there in your tomcat directory

Regards

Prasanna.B

Prasua at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12
Hi Prasu!I have solved this problem and implemented a servlet class programming.This error just due to that I wrote the web.xml in not correct format.Thank you for your helping.Regards
Devemora at 2007-7-15 4:31:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...