Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant error: Make sure you have it in you classpath

 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at line 57 - you did not provide a classpath for the <java> task.
 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in 58th line i have mentioned classpath. so are you talking about that classpath only..
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
Python Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try /config/appconfig.xls in your java code?
 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried its not working.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic