• Post Reply Bookmark Topic Watch Topic
  • New Topic

J2EE newbie; Tomcat Installation Problems: First Servlet

 
vikrvijay dikembe
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,

I am new to J2EE. I did install Tomcat 5.5 and JAVA 1.5. And was testing out my first servlet. And I am lost. I have no idea where to start/look for. The error that I am getting while compilation of first servlet program are as follows:

---------------------

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\myApp\WEB-INF\cla
sses>javac HelloWorld.java

HelloWorld.java:4: package javax.servlet does not exist
import javax.servlet.*;
^
HelloWorld.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
HelloWorld.java:13: cannot find symbol
symbol: class HttpServlet
public class HelloWorld extends HttpServlet {
^
HelloWorld.java:14: cannot find symbol
symbol : class HttpServletRequest
location: class hall.HelloWorld
public void doGet(HttpServletRequest request,
^
HelloWorld.java:15: cannot find symbol
symbol : class HttpServletResponse
location: class hall.HelloWorld
HttpServletResponse response)
^
HelloWorld.java:16: cannot find symbol
symbol : class ServletException
location: class hall.HelloWorld
throws ServletException, IOException {
^
6 errors
------------------------------------------------

any help is greatly appreciated.

Thanks
VJ
 
G Horie
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you need to set your CLASSPATH to include the servlet-api.jar. You can find a copy of this jar file in %CATALINA_HOME%\common\lib\servlet-api.jar (windows) or $CATALINA_HOME/common/lib/servlet-api.jar (unix).

- Greg.
 
vikrvijay dikembe
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg:

Thanks for taking time to reply.

I did include the complete servlet-api.jar path in my path enviornment variable. I am not sure what is wrong with my setup.

vj,
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not your PATH environment variable, your CLASSPATH environment variable.
 
vikrvijay dikembe
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben, Greg:

Well, looks like I am getting old. I didn't pay attention to the CLASSPATH, rather was thinking PATH.

Thanks again,
-VJ
 
Sam Sun
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi vikrvijay,

Did you solve this problem?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!