日期:2014-05-20 浏览次数:20649 次
i set my PATH for the jdk C:\Program Files\Java\jdk1.6.0 \bin (cek if your in bin too cuz the class are in bin) this is just for the class for j2SE
then if you create project that extends HttpServlet in normal compile (cmd) the class will not found cuz it not in the C:\Program Files\Java\jdk1.6.0\bin so you must to add the classpath for compile in tomcat = c:\Apache Tomcat\lib\servlet-api.jar (just foundservlet-api.jar)
so the command line is
javac -classpath "c:\Apache Tomcat\lib\servlet-api.jar" yourfile.java
?
转自: http://www.java-forums.org/java-servlet/21578-package-javax-servlet-does-not-exist.html