Tsz Wo (Nicholas), Sze wrote:
Hi Balu,

Unfortunately, DistCp does not have a public Java API.  One simple way is to 
invoke DistCp.main(args) in your java program, where args is an array of the 
string arguments you would pass in the command line.

That's a method with System.exit() in, so either you run under a security manager or your app fails without warning

Better to create your own Configuration instance, then a new DistCp object

DistCp distcp = new DistCp(conf);
int res = ToolRunner.run(distcp, args);

It's still going to log at System.out/System.err instead of a log API, but your JVM should stay around without you having to jump through security manager hoops

Reply via email to