Solved

Java Servlet Installation

Posted on 2003-11-12
6
709 Views
Last Modified: 2013-11-21
Dear All The Experts,

         I need your help that to teach me how to install the servlet in Windows XP. I am new in using servlet. And this is very urgent for me. Thank you for your help.


Regards,
  Jocelyn
0
Comment
Question by:jocelynyip
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
fz2hqs earned 125 total points
ID: 9738364
There isn't anything native in XP that will allow you to run servlets. You will need to get an additional application to do it. Best bet might be to get Apache and Tomcat
0
 
LVL 9

Expert Comment

by:fz2hqs
ID: 9738367
..or IBM's Weblogic but that might be more than you can afford
0
 
LVL 4

Assisted Solution

by:af500
af500 earned 125 total points
ID: 9739408
JRun is good too and more affordable ...
Demo here:
http://www.macromedia.com/cfusion/tdrc/index.cfm?product=jrun
0
 
LVL 2

Expert Comment

by:SuperKarateMonkey
ID: 9751322
Just go get Tomcat.  It's free, it's the best servlet engine out there, and it's got a built-in web server.  Using anything else is madness.

1.  Download Tomcat -- Go to:

http://apache.webmeta.com/jakarta/tomcat-4/v4.1.29/bin/

and find the link that says:

jakarta-tomcat-4.1.29.exe  

Download that application, (ignore the others,) and run the installer to install both JDK 1.4 and Tomcat.

2.  Put servlet.jar in your classpath -- Find, somewhere in the directory structure where you installed Tomcat, the file called servlet.jar.  Copy that file, and put an additional copy in the following location:

%JAVA_HOME%\jre\lib\ext

Where %JAVA_HOME% is where you installed you Java SDK.  Usually it's something like C:\j2sdk1.4..., but it could be different, depending on the options you chose during the install process.

3.  Compile a servlet class -- Write a java class that extends the HttpServlet class.  Override the doGet() method to return whatever type of web page you'd like.  Then compile it.

4.  Create a directory structure like this:

%TOMCAT_HOME%\webapps\firstapp\WEB-INF\classes
%TOMCAT_HOME%\webapps\firstapp\WEB-INF\lib

Where TOMCAT_HOME is whereever you installed Tomcat.

5.  Put your .class file into the \classes\ directory I described above.

6.  Create a file named web.xml, and dump this text in it:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
   <display-name>CBS TapeTrack Database</display-name>
   <description>Utility to track Tapes Stored using the TapeTrack System</description>
   <servlet>
      <servlet-name>First Servlet</servlet-name>
      <display-name>First Servlet</display-name>
      <servlet-class>FirstServlet</servlet-class>
   </servlet>
   <servlet-mapping>
      <servlet-name>First Servlet</servlet-name>
      <url-pattern>/first</url-pattern>
   </servlet-mapping>
</web-app>

The only thing you change is the place where it says: "FirstServlet", (without the space, in between the <servlet-class> tags.  Change that to whatever your servlet is named.  Save that file in the \WEB-INF\ directory above.

7.  If you've done everything I just told you to do, then open the Services control panel, start, (or restart if it's already running,) You should now be serving up the servlet page you wrote.  To check it, open a browser window and go to:

http://localhost/firstapp/first:8080

or

http://localhost/firstapp/first

One of them will work, depending on which port Tomcat is listenin to:  80, (the default for web browsers,) or 8080, the default for a newly installed Tomcat instance.

Congrats.  You should now have written your first servlet.
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question