The moose likes Ant, Maven and Other Build Tools and the fly likes Write an ant task to check if a file exists Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Write an ant task to check if a file exists" Watch "Write an ant task to check if a file exists" New topic
Author

Write an ant task to check if a file exists

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
I am new to ant.
How to write a task to see if a .jar file is in a given location, if its there, then whether or not a given .class file is in it?
What ant tutorial do you recommand.
Thank you
Garandi
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Ant has an <avaliable /> task which checks if a resource is there. You can use this to test if your jar exists. Also it can be used to check whether a particular class is in the classpath. So though you can't check the contents of a jar directly, you can handle ClassDefNotFound exceptions a little more helpfully.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
IntelliJ Java IDE
 
subject: Write an ant task to check if a file exists
 
Threads others viewed
String operations
including xml file in .ear file
Ant task to generate a list file
Software that automatically creates your getters and setters
Write to file in Ant
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture