Ant Javac and Commandline Javac give different results

后端 未结 2 1909
深忆病人
深忆病人 2021-01-26 19:37

I have a class that imports some servlet libraries. When I compile it from command-line it is fine.

When I use the ant compile task to compile it, it gives the errors t

2条回答
  •  暖寄归人
    2021-01-26 19:53

    For some reason, the JAR file containing the Servlet API is part of your classpath when you compile your program in command line. However, it's not in the classpath of the javac Ant task.

    You should explicitely add the JAR file to the classpath in your javac Ant task. There are several ways to do that; please read http://ant.apache.org/manual/Tasks/javac.html

提交回复
热议问题