或者说你自己的类,
没有加入classpath

解决方案 »

  1.   

    EffectNum没有定义呀。
    加一句:
    SimpleDateFormat EffectNum = new SimpleDateFormat();
    试试。
      

  2.   

    我只修改了下面的几行:
          //dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
          dbDriver = "com.sybase.jdbc2.jdbc.SybDriver";
          //dbURL = "jdbc:odbc:sybase12";
          dbURL = "jdbc:sybase:Tds:10.1.22.104:5000/rtwrdb";
    TO zhu_liping(zz):
    我所有的class都放在D:\wwwroot\WEB-INF\classes\Legend\water下了源文件也都在该目录下,在该目录下编译不对吗?
      

  3.   

    TO:forjie(风信子)
    不行! EffectNum是我同目录下的一个class:EffectNum.class
      

  4.   

    我仔细看了一下问题都出现在我的自定义类上,但这些类都在D:\wwwroot\WEB-INF\classes\Legend\water目录下,也就是与我要编译的类在同一目录下,为什么会找不到呢?
      

  5.   

    package Legend.water;没错,都在D:\wwwroot\WEB-INF\classes\Legend\water目录下。
      

  6.   

    在classpath中加入D:\wwwroot\WEB-INF\classes
      

  7.   

    我试了,D:\wwwroot\WEB-INF\classes\Legend\water>javac -classpath D:\wwwroot\WEB-INF\classes DBDisplay.java,但还是有问题,但好像问题不一样了。DBDisplay.java:114: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException,IOException {
                            ^
    DBDisplay.java:114: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException,IOException {
                                                    ^
    DBDisplay.java:114: cannot resolve symbol
    symbol  : class ServletException
    location: class Legend.water.DBDisplay
        public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException,IOException {^
    DBDisplay.java:334: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throw
    s ServletException,java.io.IOException {
                             ^
    DBDisplay.java:334: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throw
    s ServletException,java.io.IOException {
                                                     ^
    DBDisplay.java:334: cannot resolve symbol
    symbol  : class ServletException
    location: class Legend.water.DBDisplay
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throw
    s ServletException,java.io.IOException {  ^
    DBDisplay.java:340: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) thro
    ws ServletException,java.io.IOException {
                              ^
    DBDisplay.java:340: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) thro
    ws ServletException,java.io.IOException {
                                                      ^
    DBDisplay.java:340: cannot resolve symbol
    symbol  : class ServletException
    location: class Legend.water.DBDisplay
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) thro
    ws ServletException,java.io.IOException {   ^
    DBDisplay.java:346: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        public void DisplayDataFromSQL(String aSQLSelect, HttpServletRequest req, Ht
    tpServletResponse resp) throws Exception {
                                                          ^
    DBDisplay.java:346: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        public void DisplayDataFromSQL(String aSQLSelect, HttpServletRequest req, Ht
    tpServletResponse resp) throws Exception {
                                                                                  ^
    DBDisplay.java:389: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        public void DisplayData(String aDataObjectFile, HttpServletRequest req, Http
    ServletResponse resp) throws Exception {
                                                        ^
    DBDisplay.java:389: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        public void DisplayData(String aDataObjectFile, HttpServletRequest req, Http
    ServletResponse resp) throws Exception {
                                                                                ^
    DBDisplay.java:436: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        public void DisplayDataFromTable(String aTID, String aBeginDate, String aEnd
    Date, String STCDT[], HttpServletRequest req, HttpServletResponse resp, int mPag
    e,float mOtherValue) throws IOException {                      ^
    DBDisplay.java:436: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        public void DisplayDataFromTable(String aTID, String aBeginDate, String aEnd
    Date, String STCDT[], HttpServletRequest req, HttpServletResponse resp, int mPag
    e,float mOtherValue) throws IOException {                                              ^
    DBDisplay.java:936: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
         public  static void DisplayText(String sHead,String sBody,String sBottom,Ht
    tpServletRequest req, HttpServletResponse resp) throws IOException
                                                                                  ^
    DBDisplay.java:936: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
         public  static void DisplayText(String sHead,String sBody,String sBottom,Ht
    tpServletRequest req, HttpServletResponse resp) throws IOException                      ^
    DBDisplay.java:975: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
        public void DispApplet(String aTID, String aBeginDate, String aEndDate, Stri
    ng STCDT[],HttpServletRequest req,HttpServletResponse resp,String HistYear) thro
    ws SQLException,IOException {           ^
    DBDisplay.java:975: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
        public void DispApplet(String aTID, String aBeginDate, String aEndDate, Stri
    ng STCDT[],HttpServletRequest req,HttpServletResponse resp,String HistYear) thro
    ws SQLException,IOException {                                  ^
    DBDisplay.java:1136: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.DBDisplay
      public void DisplayStat(String TID,String STCDT[],String BeginDate,String EndD
    ate,HttpServletRequest req, HttpServletResponse res) throws IOException    ^
    DBDisplay.java:1136: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.DBDisplay
      public void DisplayStat(String TID,String STCDT[],String BeginDate,String EndD
    ate,HttpServletRequest req, HttpServletResponse res) throws IOException                            ^
    DBDisplay.java:49: cannot resolve symbol
    symbol  : variable super
    location: class Legend.water.DBDisplay
          super.init(config);
          ^
      

  8.   

    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:5: package javax.servle
    t.http does not exist
    import javax.servlet.http.*;
    ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:6: package javax.servle
    t does not exist
    import javax.servlet.*;
    ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:16: cannot resolve symb
    ol
    symbol  : class HttpServlet
    location: class Legend.water.GetDispData
    public class GetDispData extends HttpServlet {
                                     ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:34: cannot resolve symb
    ol
    symbol  : class ServletConfig
    location: class Legend.water.GetDispData
        public void init(ServletConfig config) throws ServletException {
                         ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:34: cannot resolve symb
    ol
    symbol  : class ServletException
    location: class Legend.water.GetDispData
        public void init(ServletConfig config) throws ServletException {
                                                      ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:98: cannot resolve symb
    ol
    symbol  : class HttpServletRequest
    location: class Legend.water.GetDispData
        public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException,IOException {
                            ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:98: cannot resolve symb
    ol
    symbol  : class HttpServletResponse
    location: class Legend.water.GetDispData
        public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException,IOException {
                                                    ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:98: cannot resolve symb
    ol
    symbol  : class ServletException
    location: class Legend.water.GetDispData
        public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException,IOException {^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:166: cannot resolve sym
    bol
    symbol  : class HttpServletRequest
    location: class Legend.water.GetDispData
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throw
    s ServletException,java.io.IOException {
                             ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:166: cannot resolve sym
    bol
    symbol  : class HttpServletResponse
    location: class Legend.water.GetDispData
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throw
    s ServletException,java.io.IOException {
                                                     ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:166: cannot resolve sym
    bol
    symbol  : class ServletException
    location: class Legend.water.GetDispData
        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throw
    s ServletException,java.io.IOException {  ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:173: cannot resolve sym
    bol
    symbol  : class HttpServletRequest
    location: class Legend.water.GetDispData
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) thro
    ws ServletException,java.io.IOException {
                              ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:173: cannot resolve sym
    bol
    symbol  : class HttpServletResponse
    location: class Legend.water.GetDispData
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) thro
    ws ServletException,java.io.IOException {
                                                      ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:173: cannot resolve sym
    bol
    symbol  : class ServletException
    location: class Legend.water.GetDispData
        protected void doPost(HttpServletRequest req, HttpServletResponse resp) thro
    ws ServletException,java.io.IOException {   ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:183: cannot resolve sym
    bol
    symbol  : class HttpServletResponse
    location: class Legend.water.GetDispData
        public void sendDataList(HttpServletResponse response,Object avector) {
                                 ^
    D:\wwwroot\WEB-INF\classes\Legend\water\MaxStat.java:9: package javax.servlet.ht
    tp does not exist
    import javax.servlet.http.HttpServletRequest;
                              ^
    D:\wwwroot\WEB-INF\classes\Legend\water\MaxStat.java:10: package javax.servlet.h
    ttp does not exist
    import javax.servlet.http.HttpServletResponse;
                              ^
    D:\wwwroot\WEB-INF\classes\Legend\water\MaxStat.java:698: cannot resolve symbol
    symbol  : class HttpServletRequest
    location: class Legend.water.MaxStat
      public int PrintOverStat(String aSTCDT,String aBeginDate,String aEndDate,HttpS
    ervletRequest req, HttpServletResponse resp) throws SQLException,IOException
                                                                               ^
    D:\wwwroot\WEB-INF\classes\Legend\water\MaxStat.java:698: cannot resolve symbol
    symbol  : class HttpServletResponse
    location: class Legend.water.MaxStat
      public int PrintOverStat(String aSTCDT,String aBeginDate,String aEndDate,HttpS
    ervletRequest req, HttpServletResponse resp) throws SQLException,IOException                   ^
    D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java:40: cannot resolve symb
    ol
    symbol  : variable super
    location: class Legend.water.GetDispData
          super.init(config);
          ^
    D:\wwwroot\WEB-INF\classes\Legend\water\OverStat.java:9: package javax.servlet.h
    ttp does not exist
    import javax.servlet.http.HttpServletRequest;
                              ^
    D:\wwwroot\WEB-INF\classes\Legend\water\OverStat.java:10: package javax.servlet.
    http does not exist
    import javax.servlet.http.HttpServletResponse;
                              ^
    D:\wwwroot\WEB-INF\classes\Legend\water\OverStat.java:323: cannot resolve symbolsymbol  : class HttpServletRequest
    location: class Legend.water.OverStat
      public int PrintOverStat(String aSTCDT,String aBeginDate,String aEndDate,HttpS
    ervletRequest req, HttpServletResponse resp) throws SQLException,IOException
                                                                               ^
    D:\wwwroot\WEB-INF\classes\Legend\water\OverStat.java:323: cannot resolve symbolsymbol  : class HttpServletResponse
    location: class Legend.water.OverStat
      public int PrintOverStat(String aSTCDT,String aBeginDate,String aEndDate,HttpS
    ervletRequest req, HttpServletResponse resp) throws SQLException,IOException                   ^
    Note: D:\wwwroot\WEB-INF\classes\Legend\water\GetDispData.java uses or overrides
     a deprecated API.
    Note: Recompile with -deprecation for details.
    57 errors
    >_<我看不懂,Java我才入门呀!
      

  9.   

    把d:\program files\jdk\lib\tools.jar;d:\program files\jdk\lib\dt.jar
    加入到你的classpath。
    其中的d:\program files\jdk换成你的安装路径。
      

  10.   

    是环境变量中的CLASSPATH吗?我加了,并且重起了机器,不好用,错误依旧。如果在DOS提示符下输入命令行我不会写,请 namowen指教,不胜感激!
      

  11.   

    你的jdk的lib目录下没有servlet.jar,去下载一个,放到lib目录下,并加入classpath。
      

  12.   

    namowen兄servlet.jar那里有?(在线等待)
      

  13.   

    第一次编译servlet程序。
    1 首先到http://java.sun.com/products/servlet/2.2/ 去下载一个servlet.jar 回来。
    2 把他放到jdk 的 lib 目录下。
    3 在win2000 的环境设定理 把classpath 进行修改。
    .;c:\jdk1.3.1\lib\tols.jar;c:\jdk1.3.1\lib\dt.jar;c:\test.;c:\jdk1.3.1\lib\servlet.jar;这样就ok了
      

  14.   

    还是有同样的问题,我说清楚一点我的包的类所在目录为D:\wwwroot\WEB-INF\classes\Legend\water下,包所在的路径是D:\wwwroot\WEB-INF\classes也就是包是Legend.water。我在DOS下的编译命令行是D:wwwroot\WEB-INF\classes\Legend\water>javac -classpath D:\wwwroot\WEB-INF\classes DBDisplay.java应该是正确的。
    还有qxjavajava兄classpath中的c:\test.;是什么路径呀,其它的我都加进去了
    我的JDK是J2SDK1.4。
      

  15.   

    D:wwwroot\WEB-INF\classes\Legend\water>javac -classpath %classpath%;D:\wwwroot\WEB-INF\classes DBDisplay.java
    试试?
      

  16.   

    编译通过了!
    请forjie说说为什么要这样写呢?谢谢!!
      

  17.   

    如果你在编译时指定classpath的话,那么系统变量classpath将会失效,加上%classpath%的话就可以把系统变量classpath全部读出来。
      

  18.   

    谢谢各位!
    我再晚些时候就要结帐了,请各位仁兄如愿意请留下E_mail或QQ号好吗?可以方便我们交流。( 主要方便我可以麻烦大家:-P )