当前位置: 代码迷 >> J2SE >> 编译J2SE跟J2EE时JAVA_HOME的区别
  详细解决方案

编译J2SE跟J2EE时JAVA_HOME的区别

热度:7527   发布时间:2013-02-25 00:00:00.0
编译J2SE和J2EE时JAVA_HOME的区别

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