unable to compile a servlet in ubuntu
Posted
by
codeomnitrix
on Stack Overflow
See other posts from Stack Overflow
or by codeomnitrix
Published on 2010-12-30T10:43:33Z
Indexed on
2010/12/30
10:53 UTC
Read the original article
Hit count: 315
I am newbie to j2ee. I have download and installed j2eesdk-1_4_03-linux.bin in my ubuntu 10.04 distribution. and then i tried to code my first servlet in it as:
import java.io.*;
import javax.servelet.*;
import javax.servelet.http.*;
public class HowdyServelet extends HttpServelet{
public void doGet(HttpServeletRequest request, HttpServeletResponse response) throws IOException, ServeletException{
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.println("<html>");
out.println("<head><title>howdy</title></head>");
out.println("<body>");
out.println("<center><h1>Howdy</h1></center>");
out.println("</body>");
out.println("</html>");
}
}
and here are the environment variables i set after installation:
1. J2EE_HOME=/home/vinit/SUNWappserver
2. JAVA_HOME=/home/vinit/SUNWappserver/jdk
3. CLASSPATH=/home/vinit/SUNWappserver/lib
and now i tried to compile the servlet using
javac HowdyServelet.java
But i got following errors:
HowdyServelet.java:2: package javax.servelet does not exist
import javax.servelet.*;
^
HowdyServelet.java:3: package javax.servelet.http does not exist
import javax.servelet.http.*;
^
HowdyServelet.java:5: cannot find symbol
symbol: class HttpServelet
public class HowdyServelet extends HttpServelet{
^
HowdyServelet.java:6: cannot find symbol
symbol : class HttpServeletRequest
location: class HowdyServelet
public void doGet(HttpServeletRequest request, HttpServeletResponse response) throws IOException, ServeletException{
^
HowdyServelet.java:6: cannot find symbol
symbol : class HttpServeletResponse
location: class HowdyServelet
public void doGet(HttpServeletRequest request, HttpServeletResponse response) throws IOException, ServeletException{
^
HowdyServelet.java:6: cannot find symbol
symbol : class ServeletException
location: class HowdyServelet
public void doGet(HttpServeletRequest request, HttpServeletResponse response) throws IOException, ServeletException{
^
6 errors
So how to compile this servlet. Thanks in advance.
© Stack Overflow or respective owner