aspose file tools*
The moose likes Servlets and the fly likes Run ant in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Run ant in servlet" Watch "Run ant in servlet" New topic
Author

Run ant in servlet

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
Can I run Ant scripts in servlet? How to do it?
Thanks.


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
use the exec method to make a call to the ant command line tool


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
Thanks Tim:
Tried that:
String cmd = "java -Dant.home=c:\\temp\\ant org.apache.tools.ant.Main";
Runtime rt = Runtime.getRuntime();

try {
Process pr = rt.exec(cmd);
}
...
Got this:
java.lang.NoClassDefFoundError: org/apache/tools/ant/Main
ant jar is in WEB-INF/lib too.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Run ant in servlet
 
Similar Threads
JUnitEE report
Can Ant run script generated by XDE?
ANT - JUNIT problems
Running Ant from a Servlet
This weeks Giveaway