When importing the javax.servlet package in the java file, this package is found by eclipse. However, when running an Ant build I get the error 'package javax.servlet does not exist'. I'm guessing this is a build path issue but I'm not sure how to fix it. I've refreshed and cleaned the project, changed the order of the build path and verified that the package is in the expected .jar file but the error will not go away. Any ideas?
Inside eclipse, the compile is using the server runtime jars get these definitions.
In Ant you need to add the appropriate jar files.
For example, you can use the servlet-api.jar from Apache Tomcat's lib directory. This doesn't mean you can only deploy against tomcat, you should be able to deploy against any application server which implements the same version of the Servlet API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With