The following web site gives an excellent example on how to call ant script from java.
http://www.srccodes.com/p/article/9/Invoke-and-Execute-Hello-World-Ant-Script-Programmatically-using-Java-Code
Few important points when trying to run this code from Jdeveloper
Make sure you are importing the following jar files in the project library path
ant-launcher.jar,Ant.jar,XercesImpl.jar,Ant-contrib-1.0b3.jar
These jars can be located in the following directory
JDEV_HOME\modules\org.apache.ant_1.7.1\lib
If you will not import all the jar files you may get following errors
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/AntMain
So make sure you are importing the jar files from your own jdev home from the path specified.
No comments:
Post a Comment