This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error while working with tomcat

 
rajaraman navaneethan
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
i have just started using tomcat.if i try to compile my servlet i am getting errors.it says that it cannot find the package javax.servlet.* and related errors.
please guide me as how i should set the environment and avoid these errors.

regards,
Raja
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Before compiling you should add the path of the servlet.jar file to ur classpath variable. I assume that you are working on windows and if so set the classpath variable as follows:

(1).In DOS-Prompt
> set CLASSPATH=%CLASSPATH%;x:\Program Files\Apache Tomcat\common\lib\servlet.jar;

OR

(2). Goto System Properties through RightClick on My Computer and select Properties. Select Advanced tab and select the environment variables. In that append the value of Classpath variable with the path.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!