[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Java Servlet Installation

Posted on 2003-11-12
6
Medium Priority
?
724 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
4 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

830 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