This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant error: Make sure you have it in you classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant error: Make sure you have it in you classpath" Watch "Ant error: Make sure you have it in you classpath" New topic
Author

Ant error: Make sure you have it in you classpath

Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 80
Hi,
whn I am running this build.xml file
c:/ant run
I am getting the error Could not find testscripts.TestExecute. Make sure you have it in you classpath

please find the build.xml




Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Look at line 57 - you did not provide a classpath for the <java> task.


JBoss In Action
Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 80
in 58th line i have mentioned classpath. so are you talking about that classpath only..
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Look at the end of line 57 - you are terminating the <java> task on that line. The <classpath> on lines 58-59 is not part of the <java> task.
Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 80
Hi Peter,
Thanks.classpath problem get resolved.one more problem
Inside TestExecute.java file I am specifying the path of one excel sheet.
and that excelsheet is inside
D:/Project13/sonnetframwwork1/config folder.

so when I say.
ant run
it is not able to find that excelsheet

I haven't metioned the path of excel sheet in build.xml so where to mentioned i dont know.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

I have no idea. That file is not a Java file, but rather a data file. What code are you using to open the file?
Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 80
actuly inside TestExecute.java file I am specifying path like this
("src\\config\\appconfig.xls");

to get the data from excelsheet

but if I chage this code in TestExecute.java as

("D:\\Project13\\src\\config\\appconfig.xls");

it works fine..but in this case i need to change in the code.but I dont want to do this.
running through ANT its not able to find the appconfig.xls( "src\\config\\appconfig.xls");
Sumit Bisht
Ranch Hand

Joined: Jul 02, 2008
Posts: 329

Did you try /config/appconfig.xls in your java code?
Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 80
I have tried its not working.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

I didn't ask what path you were using, I asked what code you were using. You should be using one of the getResource methods from Class, such as Class.getResourceAsStream.

Exactly where is the file? (Oh, I see it now, you have it at D:\\Project13\\src\\config\\appconfig.xls) You originally said it was at D:/Project13/sonnetframwwork1/config, so I assume the full path would be D:/Project13/sonnetframwwork1/config/appconfig.xls. But since Sumit's suggestion didn't work, I suspect that the file is not there.

Is the XSL file in the JAR file? Or do you intend to have the file be external to the JAR? If you have it external to the JAR, I recommend using a system property to identify the location of the XSL file, and if none is given to use "appconfig.xsl" as the default path, which would mean that it is in the current working directory.

By the way, when you run Ant, which directory are you in? Are you in D:/Project13/sonnetframwwork1? If you are not in d:/Project13, then the path of "src\\config\\appconfig.xls" will not work. Relative paths are based on the current working directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant error: Make sure you have it in you classpath