This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Error while executing build.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Error while executing build.xml" Watch "Error while executing build.xml" New topic
Author

Error while executing build.xml

Danish Araquei
Greenhorn

Joined: Jul 05, 2006
Posts: 19
Hi All,

While executing build.xml i am getting following error




[javac]
[javac] D:\ABN\WSAbnjags\src\com\indussoft\Jags\Transactions\QueryModule\JTS
L_QMSessionBean.java:204: cannot resolve symbol
[javac] symbol : class LSSystemException
[javac] location: class com.indussoft.Jags.Transactions.QueryModule.JTSL_QMS
essionBean

Description

I want to create ANT script to compile java file which is located at
com\indussoft\Jags\Transactions\QueryModule folder

for that purpose i also have to extends one class name LSSystemException

Here is my ANT build.xml

<?xml version="1.0" ?>
<project name="Abn Jaguar" default="main" basedir=".">

<property name="srcDir" location="src/com/indussoft/Jags/Transactions/QueryModule"/>
<property name="distDir" location="src/com/indussoft/Jags/Transactions/QueryModule"/>
<property name="IncludeDir" location="src"/>
<property name="UtilitiesDir" location="src/com/indussoft/Jags/Utilities"/>
<property name="lib4" value="src/j2ee.jar"/>
<property name="lib5" value="src/poi-scratchpad-3.0-rc4-20070503.jar"/>
<property name="lib6" value="src/poi-contrib-3.0-rc4-20070503.jar"/>
<property name="lib7" value="src/poi-3.0-rc4-20070503.jar"/>



<target name="main" description="Compilation target">
<echo>
Compile Main Java .
</echo>

<javac srcdir="${srcDir}" destdir="${distDir}" >
<classpath>
<pathelement location="${IncludeDir}/com.indussoft.Jags.LSExceptions" />
<pathelement location="${UtilitiesDir}" />
<pathelement location="${lib4}" />
<pathelement location="${lib5}" />
<pathelement location="${lib6}" />
<pathelement location="${lib7}" />
</classpath>
</javac>
<echo>
Completed.
</echo>
</target>


</project>
Danish Araquei
Greenhorn

Joined: Jul 05, 2006
Posts: 19
Hi All ,

just want to add one more thing

in my build.xml code i try all the combination

<pathelement location="${IncludeDir}/com/indussoft/Jags/LSExceptions" />
<pathelement location="${IncludeDir}.com.indussoft.Jags.LSExceptions" />
<pathelement location="${IncludeDir}/com.indussoft.Jags.LSExceptions" />

but its not working.....

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Your srcDir and distDir are incorrect. The should both be "src". (Well, actually, I disagree with placing compiled class file in the same directory as the Java source file, but that is a topic for another discussion.)
Also, this location is incorrect:

location="${IncludeDir}/com.indussoft.Jags.LSExceptions"

Though not knowing you directory structure and the exact location of the LSSystemException class, I could not offer a better gues than to change it to:

location="${IncludeDir}"

By the way, the issue here is one of not understanding how package names relate to directory names. You will probably want to review that information from a basic Java programming text. It is a key concept in being able to understand how Java applications (a misnomer if there was one) are structured.


JBoss In Action
Danish Araquei
Greenhorn

Joined: Jul 05, 2006
Posts: 19
Hi Peter,

thanks for your reply and valuable suggestion

My Directory Structure is

com
|
|
indussoft
|
|
Jags
|
|---------------|
| |
Transactions LSExceptions
| |
| LSSystemException.class
QueryModule
|
*.class

peter i want to built ANT script for QueryModule Directory
Danish Araquei
Greenhorn

Joined: Jul 05, 2006
Posts: 19
Hi Peter,

thanks for your reply and valuable suggestion

My Directory Structure is

com >> indussoft >> Jags >> Transactions >> QueryModule >> *.class
com >> indussoft >> Jags >> LSSystemException >> LSSystemException.class

peter i want to built ANT script for QueryModule Directory ,please suggest the valuable solution.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

I assume that the com directory is in the src directory and that build.xml is located in the parent directory of the source directory. In other words, you have this:

some-dir/build.xml
some-dir/src/com/...

If that is true, try these changes:



All of your Java source files are in the src directory, and based the destdir setting, all class files are also in src. Therefore you do not need to include any information about those directories in the classpath - all you need are the jar files. And because you have all of your JAR files in the src directory, using a fileset to declare them is easier than using individual path element.
Danish Araquei
Greenhorn

Joined: Jul 05, 2006
Posts: 19
hi peter

i got the solution ...thank you very much for your support
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error while executing build.xml
 
Similar Threads
Compile and run a java program thru ant
echo classpath in build
help in setting classpath in ant
Problem in ServiceGen task
Way to simply javac task?