我已经检查了几乎所有可能发生错误的帖子。我已经编辑了几乎所有在线提供的环境变量。这些是我的环境变量:
ANT_HOME = C:\ Ant9; C:\ Tomcat7 \ lib \ servlet-api.jar
CLASSPATH = C:\ Program Files \ Java \ jdk1.6.0_24 \ bin; C:\ Program Files \ Java \ jre6 \ bin; C:\ Tomcat7 \ lib \ servlet-api。罐;
JAVA_HOME = C:\ Program Files \ Java \ jdk1.6.0_24
路径 = C:\ Program Files \ Java \ jdk1.6.0_24 \ bin
TOMCAT_HOME = C:\ Tomcat7
C:\Tomcat7\webapps\DBConnection\WEB_INF\classes\DBConnection>javac -cp .,C:\Tomc
at7\lib\servlet-api.jar DBConnnection.java
DBConnnection.java:4: package javax.servlet does not exist
import javax.servlet.*;
^
DBConnnection.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
DBConnnection.java:11: cannot find symbol
symbol: class HttpServlet
public class DBConnnection extends HttpServlet
^
DBConnnection.java:14: cannot find symbol
symbol : class HttpServletRequest
location: class DBConnection.DBConnnection
public void doGet(HttpServletRequest request, HttpServletResponse response) th
rows ServletException, IOException
^
DBConnnection.java:14: cannot find symbol
symbol : class HttpServletResponse
location: class DBConnection.DBConnnection
public void doGet(HttpServletRequest request, HttpServletResponse response) th
rows ServletException, IOException
^
DBConnnection.java:14: cannot find symbol
symbol : class ServletException
location: class DBConnection.DBConnnection
public void doGet(HttpServletRequest request, HttpServletResponse response) th
rows ServletException, IOException
^
DBConnnection.java:53: cannot find symbol
symbol : class EmployeeInformation
location: class DBConnection.DBConnnection
EmployeeInformation empInfo = new EmployeeInformation();
^
DBConnnection.java:53: cannot find symbol
symbol : class EmployeeInformation
location: class DBConnection.DBConnnection
EmployeeInformation empInfo = new EmployeeInformation();
^
DBConnnection.java:13: method does not override or implement a method from a sup
ertype
@Override
^
9 errors
我真的很困惑如何继续!一直困在这一点!!
答案 0 :(得分:4)
您应该使用;
来分隔Windows中的类路径条目
javac -cp .;C:\Tomcat7\lib\servlet-api.jar DBConnnection.java
。
但是,您使用了逗号,
。将逗号更改为分号
注意:* nix系列环境使用冒号:
来分隔类路径条目