tlDeveloper
asked on
Project compiles fine in Eclipse but not with ant file
I am making a simple java-based web application using Eclipse and Tomcat. The Eclipse project compiles without any problem in Eclipse, using the compilation capability provided within Eclipse. But, when I try to compile use an Ant build file (build.xml) within the Eclipse project, it tells me that it cannot find the servlet package when Eclipse was able to. This package is definitely recognised by Eclipse because when I remove the jar file from Eclipse, the Eclipse compiler complains. I am very stuck on this, help would be much appreciated. Here is the compile error from the Ant build:
Buildfile: C:\TenantLife\workspace\RA
init:
compile:
[javac] Compiling 8 source files to C:\apache-tomcat-5.5.16\we
[javac] C:\apache-tomcat-5.5.16\we
[javac] import javax.servlet.http.HttpSer
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] import javax.servlet.http.HttpSer
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] symbol : class HttpServletRequest
[javac] location: class com.springbook.BikesContro
[javac] public ModelAndView handleRequest(HttpServletR
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] symbol : class HttpServletResponse
[javac] location: class com.springbook.BikesContro
[javac] public ModelAndView handleRequest(HttpServletR
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] symbol : class HttpServletRequest
[javac] location: class com.springbook.EditBikeCon
[javac] public ModelAndView handleRequest(HttpServletR
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] symbol : class HttpServletResponse
[javac] location: class com.springbook.EditBikeCon
[javac] public ModelAndView handleRequest(HttpServletR
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] symbol : class HttpServletRequest
[javac] location: class com.springbook.SubmitBikeC
[javac] public ModelAndView handleRequest(HttpServletR
[javac] ^
[javac] C:\apache-tomcat-5.5.16\we
[javac] symbol : class HttpServletResponse
[javac] location: class com.springbook.SubmitBikeC
[javac] public ModelAndView handleRequest(HttpServletR
[javac] ^
[javac] 8 errors
BUILD FAILED
C:\TenantLife\workspace\RA
Total time: 2 seconds
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
tlDeveloper, why in that case did you accept that answer, which in any case wasn't right?
ASKER
Both sets of comments were helpful in pointing me in the right direction of finding the problem. I would have liked to accept answers for both people to give both credit but the site does not allow it, sorry. Thank you for the help though.
>>but the site does not allow it, sorry.
It does in fact, and can be corrected now as well.
It does in fact, and can be corrected now as well.
ASKER
I'd be happy to accept your answer as well, how do I do that? Thanks again for the help.
You don't need to do anything yet. A page editor will post in this Q. soon
objects, CEHJ - are you subscribed to Venabili's PE notifier 6 or not?
https://www.experts-exchange.com/questions/21765176/Java-PE-notifier-6-experts-please-subscribe.html
https://www.experts-exchange.com/questions/21765176/Java-PE-notifier-6-experts-please-subscribe.html
I am
:-)
ASKER
It turned out there was typo in the build.xml file where someone wrote servlet.jar instead of servlet-api.jar (which was the correct file name). The eclipse project was using a different jar file altogether and compiled for that reason. I appreciate all the advice, it really helped me get unstuck (I was looking in all the wrong places for something to be wrong).