Hello, i'm calling and Ant script from a Java program, this is a piece of code of the AntCaller class So after that, every target in the project gets executed, but the junit target that generates a report is saying that the tests failed
java.lang.ClassNotFoundException:xxx at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source)
. The strange thing is that the same script called from the command line works great, but I need to be able to call it from within the java program. What can i do?
When you run Ant from the command line, it automatically includes every JAR file in the ant_home/lib directory in the classpath. This is in addition to the directories and JARs specified in the classpath property of any given Ant task. Because you are getting a ClassNotFoundException, you are missing one of those JARs or directories in your classpath. Unfortunately, I have no idea where class 'xxx' is located (I assume you replaced the actual class name with 'xxx').