?
Solved

Java Servlet Installation

Posted on 2003-11-12
6
Medium Priority
?
722 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
fz2hqs earned 500 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 500 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 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