把javax包的路径设到classpath里

解决方案 »

  1.   

    在classpath中声明你的servlet.jar所在的路径
      

  2.   

    servlet.jar在哪里可以找到啊?
      

  3.   

    tomcat,weblogic,jbuilder这些里面都有
      

  4.   

    在系统环境变量classpath里声明servlet.jar的路径,然后重启机器或者把servlet.jar拷贝到$JAVA_HOME/jre/lib/ext/里面
      

  5.   

    我已经在classpath中加入路径了。classpath=c:\tomcat40\bin\servlet.jar;
    但为什么还是不能够找到其中的有些类呢?
    代码如下:
    package com.kite.chp06;import java.io.*;
    import javax.servlet.*;public class SEvent implements HttpSessionBindingListener
    {
    public void valueBound(HttpSessionBindingEvent event)
    {
    System.out.println("valueBound is called");
    }

    public void valueUnbound(HttpSessionBindingEvent event)
    {
    System.out.println("valueUnbound is called!");
    }
    }错误信息如下:
    c:\javac SEvent.javaSEvent.java:6: cannot resolve symbol
    symbol  : class HttpSessionBindingListener
    location: class com.kite.chp06.SEvent
    public class SEvent implements HttpSessionBindingListener
                                   ^
    SEvent.java:8: cannot resolve symbol
    symbol  : class HttpSessionBindingEvent
    location: class com.kite.chp06.SEvent
            public void valueBound(HttpSessionBindingEvent event)
                                   ^
    SEvent.java:13: cannot resolve symbol
    symbol  : class HttpSessionBindingEvent
    location: class com.kite.chp06.SEvent
            public void valueUnbound(HttpSessionBindingEvent event)
                                     ^
    3 errors怎么办啊,各位高手,我是一个菜鸟。帮帮我啦。
      

  6.   

    import javax.servlet.*;
    import javax.servlet.http.*;修改过classpath后要重启机器
      

  7.   

    好了,我把这一句改成这样
    import javax.servlet.*;
    改成:
    import javax.servlet.http.*;
    就编译成功了,这是为什么?对了,我也在classpath中加入了servlet.jar包。
    谢谢你了,7(nomad).
    我怎么给分于你呀。
      

  8.   

    因为HttpSessionBindingListener是在javax.servlet.http下面啊