Solved

Java Servlet Installation

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

17 Experts available now in Live!

Get 1:1 Help Now