CLASSPATH for JBoss
Hi,
I'm using JBoss and I am trying to compile a HelloServlet.java. However, I
get several errors, and I think the CLASSPATH variable isn't set properly.
Currently it is:
c:\j2sdk1.4.2_10\lib\tools.jar;"C:\Program
Files\jboss-4.0.4.CR2\server\default\lib\jboss.jar";"C:\Program
Files\jboss-4.0.4.CR2\bin\run.jar";c:\j2me\midp2.0fcs\classes;.
Is this the right CLASSPATH?
The HelloServlet.java which I'm trying to compile is:
--------------------------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/** Simple servlet used to test server.
* <P>
* Taken from Core Servlets and JavaServer Pages 2nd Edition
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* © 2003 Marty Hall; may be freely used or adapted.
*/
public class HelloServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>Hello</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1>Hello</H1>\n" +
"</BODY></HTML>");
}
}
--------------------------------------------
The errors I get are:
--------------------------------------------
HelloServlet.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
HelloServlet.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
HelloServlet.java:13: cannot resolve symbol
symbol : class HttpServlet
location: class HelloServlet
public class HelloServlet extends HttpServlet {
^
HelloServlet.java:14: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloServlet
public void doGet(HttpServletRequest request,
^
HelloServlet.java:15: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloServlet
HttpServletResponse response)
^
HelloServlet.java:16: cannot resolve symbol
symbol : class ServletException
location: class HelloServlet
throws ServletException, IOException {
^
6 errors
--------------------------------------------