This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Help me solve 'package javax.servlet does not exist' error

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have completed SCJP and now started preparing for SCWCD.
I have installed tomcat6 and jdk1.5

I am not using any IDE and compiling the classes through command prompt itself.

The environment variables i have set are as follows:
CLASS_PATH - C:\jdk1.5\lib;C:\tomcat6\lib\servlet-api.jar;C:\tomcat6\lib\jsp-api.jar;C:\tomcat6\webapps
JAVA_HOME - C:\jdk1.5
Path - C:\jdk1.5\bin;C:\jdk1.5;C:\jdk1.5\jre\bin\server

When i'm trying to compile the servlet i'm getting this error

C:\tomcat6\webapps\HeadFirst\WEB-INF\classes\web>javac BeerSelectAction.java
BeerSelectAction.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
BeerSelectAction.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
BeerSelectAction.java:7: cannot find symbol
symbol: class HttpServlet
public class BeerSelectAction extends HttpServlet {
^
BeerSelectAction.java:9: cannot find symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelectAction
public void doPost(HttpServletRequest request,
^
BeerSelectAction.java:10: cannot find symbol
symbol : class HttpServletResponse


Please help me solve this error.

Thanks in advance.
 
Ranch Hand
Posts: 71
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It looks like your classpath has not well been set, please refer to this url and see if you can set it properly

http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

hope that helps you,

Regards,
Ranil
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CLASS_PATH -> CLASSPATH
 
srinivas pola
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies...

I was thinking in a complicated manner and forgot about the simple things

Anyways thanks a lot
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic