I am developing a web application using struts framework.I have all the java source files and resource files.I am trying to use Ant build tool ,but its reporting me errors about compilation like cannot find symbol ActionErrors, Action etc..I think the problem is in build.xml which is unable to include .jar files.
Here is an output error i am getting:-
C:\tomcat6\webapps\blank\WEB-INF\src>ant
Buildfile: build.xml
clean:
[delete] Deleting directory C:\tomcat6\webapps\blank\WEB-INF\classes
[mkdir] Created dir: C:\tomcat6\webapps\blank\WEB-INF\classes
prepare:
resources:
[copy] Copying 1 file to C:\tomcat6\webapps\blank\WEB-INF\classes
compile:
[javac] Compiling 2 source files to C:\tomcat6\webapps\blank\WEB-INF\classes
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:3: cannot find symbol
[javac] symbol: class Action
[javac] public class CustomerAction extends Action {
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:5: cannot find symbol
[javac] symbol : class ActionMapping
[javac] location: class CustomerAction
[javac] public ActionForward execute(ActionMapping mapping,
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:6: cannot find symbol
[javac] symbol : class ActionForm
[javac] location: class CustomerAction
[javac] ActionForm form, HttpServletRequest request,
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:6: cannot find symbol
[javac] symbol : class HttpServletRequest
[javac] location: class CustomerAction
[javac] ActionForm form, HttpServletRequest request,
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:7: cannot find symbol
[javac] symbol : class HttpServletResponse
[javac] location: class CustomerAction
[javac] HttpServletResponse response) throws Exception
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:5: cannot find symbol
[javac] symbol : class ActionForward
[javac] location: class CustomerAction
[javac] public ActionForward execute(ActionMapping mapping,
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerForm.java:3: cannot find symbol
[javac] symbol: class ActionForm
[javac] public class CustomerForm extends ActionForm {
[javac] ^
[javac] C:\tomcat6\webapps\blank\WEB-INF\src\java\mybank\app1\CustomerAction.java:18: cannot find symbol
[javac] symbol : class ActionForward
[javac] location: class CustomerAction
[javac] ActionForward forward = mapping.findForward("success");
[javac] ^
[javac] 8 errors
BUILD FAILED
C:\tomcat6\webapps\blank\WEB-INF\src\build.xml:55: Compile failed; see the compiler error output for details.
Total time: 6 seconds
I have already set the cclasspath for jar files....
Please provide help..
I am guessing that the issue is not with the build.xml file but rather with CustomerAction.java. I suspect that you do not have an import statement for the Action class. Could you post the beginning of the CustomerAction.java file, up to the class declaration (which according to the error message is on line 3).
Based on the other error messages, you are missing a number of import statements.
You buildscript does not include the servlet JAR in the classpath. The JAR is declared at line 05, but is not included anywhere in lines 24-30, which define the compile.classpath.
Or wait a second, lines 05 and 06 are mixed up - the servlet line (05) references the jdbc jar, while the jdbc line (06) references servlet jar. You should clean that up also.