• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in building project using Ant build tool

 
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

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.

So please help me to solve these problems.

Thanks in advance.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have the struts jar in the classpath? Maybe you could show some code?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And show the output from the ant build...
 
Santosh Ganapa
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you setting the classpath in your build.xml? Post the file contents here.
 
Santosh Ganapa
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my build.xml file contents...Please suggest me about what is the actual problem here with possible solution.



 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Santosh Ganapa
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all thanks Mr.Peter for your prompt reply...

I added necessary import statements in the CustomerAction.java file as you suggested, it worked fine.But I am still getting errors as:-



Please provide solution...

Code snippet for CustomerAction.java is as follow:-

 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Santosh Ganapa
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hurray I got success.......

Thanks a lot Mr. Peter for your valuable time and guidance.

Final build file with suggested changes is:-


And output is:-



I am very Happy....
reply
    Bookmark Topic Watch Topic
  • New Topic