-
June 8th, 2008, 08:40 AM
#1
Java Query
Hi AO's
Well i am new to java programming
and i was writing a new program in java servlet which is
// Hello.java
import java.io.*;
import javax.servlet.*;
public class Hello extends GenericServlet {
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("Hello, world!");
pw.close();
}
}
and while compiling in CMDi got error as follows
C :\Program Files\Java\jdk1.6.0_06\bin>javac Hello.java
Hello.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
Hello.java:5: cannot find symbol
symbol: class GenericServlet
public class Hello extends GenericServlet {
^
Hello.java:6: cannot find symbol
symbol : class ServletRequest
location: class Hello
public void service(ServletRequest request, ServletResponse response)
^
Hello.java:6: cannot find symbol
symbol : class ServletResponse
location: class Hello
public void service(ServletRequest request, ServletResponse response)
^
Hello.java:7: cannot find symbol
symbol : class ServletException
location: class Hello
throws ServletException, IOException
^
5 errors
C:\Program Files\Java\jdk1.6.0_06\bin>
what does this error resembles to
Last edited by kingkong; June 8th, 2008 at 08:41 AM.
Reason: modification
Question is not "Why are you Online"
Question is "Why are you Off line"
-
June 8th, 2008, 05:12 PM
#2
Am I right in thinking that javax.servlet is a Tomcat package (I get the feeling there might be different implementations)? Basically the error you're getting means that the Java compiler can't find the javax.servlet package. This means either:
1. You don't have the package, or
2. Your classpath isn't set up to include the servlet package.
If you have the first problem, go to http://tomcat.apache.org/ and download. If you have the second problem, find where the servlet package is installed and add it to your classpath. For info on setting the classpath correctly, see http://java.sun.com/j2se/1.3/docs/to...classpath.html.
Hope that sorts you out - just bear in mind that I'm not really a Java person, so if there's anything wrong with what I've told you, that's why.
Cheers,
ac
-
June 9th, 2008, 11:39 AM
#3
Hi Gothic Type,
I got the error i read alot on java site and finally i got the answer for that stupid question i asked
i am using JAVA SE which do not have the package of javax.servlet and because of which i got this error i should use Java EE
as per i am new to java and still my teacher of the class thought of teaching me javax.servlet , swing , and applets
on which i heard should be teached on the later stage after i got my hand properly on the pace of java
Thanks a lot for your answer
Gothic
Question is not "Why are you Online"
Question is "Why are you Off line"
Similar Threads
-
By MrLinus in forum Cosmos
Replies: 4
Last Post: April 18th, 2004, 08:01 AM
-
By gore in forum Operating Systems
Replies: 3
Last Post: March 7th, 2004, 08:02 AM
-
By vozhan in forum AntiOnline's General Chit Chat
Replies: 1
Last Post: March 6th, 2004, 09:49 PM
-
By SonofGalen in forum The Security Tutorials Forum
Replies: 7
Last Post: February 9th, 2004, 11:14 AM
-
By Remote_Access_ in forum Security Archives
Replies: 4
Last Post: January 3rd, 2002, 11:11 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|