开发者

Javac erroring out when compiling Servlet libraries

I am using ubuntu and I have set my paths to be the following:

JAVA_HOME=/usr/local/jdk1.6.0_24
export CLASSPATH=/usr/local/tomcat/lib
export JAVA_HOME

I thought that would put the servlet libraries in the compile path, but I am still getting compile errors like this:

package javax.se开发者_开发百科rvlet does not exist
    [javac] import javax.servlet.ServletException;

Any ideas how to fix this or what I am doing wrong? The general Java libraries seem to be working fine.


With jar files, simply specifying a directory containing jar files will not work. You have two options:

  1. Specify each jar file individually on the CLASSPATH:

    export CLASSPATH=/usr/local/tomcat/lib/servlet-impl.jar:/path/to/another.jar
    
  2. Since you're using Java 6, you should be able to use wildcards (to include all jars in a directory):

    export CLASSPATH=/usr/local/tomcat/lib/*
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜