I\'ve got this error message when I compiled a Java file :
error: package javax.servlet does not exist
I installed a big .SH file for Jave
You need to include the servlet-api JAR in the compile time classpath.
If you are using maven add this as a dependency in the pom.xml.
javax.servlet
servlet-api
2.5
provided
That wil include the dependency at compile time and use the Tomcat one at runtime.
If not you should add Tomcat as project target runtime through Eclipse.
This questions has some useful info on including these in an Eclipse project: How do I import the javax.servlet API in my Eclipse project?
If you are using command line to build the project, you will most likely need to add these to the classpath argument to javac to add these jars to the classpath.
See this question: How to compile servlets from command prompt?
The key part is:
javac -classpath C:\apache-tomcat-7.0.23\lib\servlet-api.jar MyTestServlet.java