• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Compiling Problems

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've installed TOMCAT 5.0 and J2SDK 1.4.2_06 n i've set my path.

I've created myproject folder, then WEB-INF and then classes folder and web.xml file.

I created HelloWorldServlet.java. and tried to compile it. But after compilation the follwing errors come

1. HelloWorldServlet.java:4: package javax.servlet does not exist
import javax.servlet.*;

2. HelloWorldServlet.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;

3. HelloWorldServlet.java:7: cannot find symbol
symbol:class HttpServlet
public class HelloWorldServlet extends HttpServlet {

4. HelloWorldServlet.java:9: cannot find symbol
symbol:class HttpServletRequest
location : classHelloWorldServlet
public void doGet(HttpServle. tRequest request, HttpServletResponse response)

5. HelloWorldServlet.java:9: cannot find symbol
symbol:class HttpServletRequest
location : classHelloWorldServlet
public void doGet(HttpServle. tRequest request, HttpServletResponse response)

6. HelloWorldServlet.java:10: cannot find symbol
symbol : class ServletException
location : class HelloWorldServlet
throws IOException, ServletException

6 errors.

Can anybody help me to resolve this problem.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure j2ee.jar (or servlet.jar) is in your CLASSPATH.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Tomcat 5x it's servlet-api.jar, found in TOMCAT_HOME\common\lib.
 
srikant sahoo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Sturrock:
Make sure j2ee.jar (or servlet.jar) is in your CLASSPATH.



I've made my classpath as C:\TOMCAT 5.0\common\lib\servlet-api.jar;

Still then this prob persists.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may need to put quotes around it because of the spaces in the path.
set CLASSPATH=%CLASSPATH%;"C:\TOMCAT 5.0\common\lib\servlet-api.jar"

If you are setting from the 'Environment Variables' section in 'My Computer' you will need to fire up a new command window for the enviromnent variable to be active.

Test by typing, from the command line:
echo %CLASSPATH%
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic