unable to compile a servlet in ubuntu
- by codeomnitrix
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.