Solved

Java Servlet Installation

Posted on 2003-11-12
6
699 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

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Website Test Question 6 107
Help Fix A 403 error 13 103
how can I temporarily cancel my monthly membership with Hostgator.com? 11 132
Setting Up Local Lan Web Server 1 47
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now