1.调用本地文件
public static void runNativeTransformation(String[] params,String filename) {
try {
//初始化
KettleEnvironment.init();
EnvUtil.environmentInit();
TransMeta transMeta = new TransMeta(filename);
//转换
Trans trans = new Trans(transMeta);
//执行
trans.execute(params); // You can pass arguments instead of null.
//等待结束
trans.waitUntilFinished();
if ( trans.getErrors() > 0 ){
throw new RuntimeException( "There were errors during transformation execution." );
}
}
catch (KettleException e ) {
// TODO Put your exception-handling code here.
System.out.println(filename);
System.