Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2004, 05:44 AM
Jil Jil is offline
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default package javax.servlet does not exist ...HELP

Hi,
Im new to servlets.
When I tryed to compile this simple servlet,

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<head>");
out.println("<title>Hello World!</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Hello World!</h1>");
out.println("</body>");
out.println("</html>");
}
}

it gave me the error->

Im using
j2sdk1.4.0
Tomcat4.1
CLASSPATH=C:\Tomcat4.1\common\lib\servlet.jar
Whats wrong with this..
I went through the web befor submit this,there were plenty of occurences of the same problem but the answers were same as "Check your classpath" for most of the times.

Pls help me on this.
Thanx in advance for any help.
best regs,
Jil.


 
Old May 27th, 2004, 01:48 PM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I had this problem as well. The problem can be with your operating environment CLASSPATH. One way to force your classpath is when you use the javac command. Specify your classpath as follows to see if it will work.

javac -classpath
 .:/webserver/jakarta/common/lib/servlet.jar:$CLASSPATH myfile.java

If this works below then you need to check your System Environment CLASSPATH setting.
 
Old July 29th, 2004, 07:25 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

If you are using IDE, check the classpath and include the file

/webserver/jakarta/common/lib/servlet.jar

 
Old September 12th, 2004, 03:58 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Alternatively, if your compiler allows you to add references, add a refereces to \common\conf\servlet-api.jar and \common\conf\jsp-api.jar






Similar Threads
Thread Thread Starter Forum Replies Last Post
javax.servlet.ServletException: Exception creating frozen84 Servlets 9 January 29th, 2007 09:13 AM
Package javax.servlet.jsp does not exist wottt JSP Basics 5 January 17th, 2007 06:37 AM
javax.servlet gauravchhabra9111 Servlets 1 January 19th, 2005 03:14 AM
javax.servlet problem anupamda JSP Basics 2 June 23rd, 2004 09:59 PM
package org.xml does not exist?? CFerthorney J2EE 1 May 10th, 2004 05:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.