求高手解决java程序中调用kettle spoon中的kjb、ktr文件
我需要写java程序来调用kettle spoon制作出来的kjb文件、ktr文件,我用的kettle是4.1.0版本(4.0以下版本用到的jar包,用到4.0上有些类找不到),求高手指点~里面要用到的jar包也告诉小弟,不胜感激!!! --------------------编程问答-------------------- public static void startDBTrans(String transName){
try
{
KettleEnvironment.init();
DatabaseMeta dataMeta = new DatabaseMeta("jilin_sale", "ORACLE", "Native", "133.193.16.14", "crmdev", "1521", "ucr_sale_sta", "123456");
KettleDatabaseRepositoryMeta repInfo = new KettleDatabaseRepositoryMeta();
repInfo.setConnection(dataMeta);
KettleDatabaseRepository rep = new KettleDatabaseRepository();
rep.init(repInfo);
rep.connect("admin", "admin");
RepositoryDirectoryInte易做图ce dir = new RepositoryDirectory();
dir.setObjectId(rep.getRootDirectoryID());
TransMeta tranMeta = rep.loadTransformation(rep.getTransformationID(transName, dir), null);
Trans trans = new Trans(tranMeta);
trans.execute(null);
trans.waitUntilFinished();
}
catch (KettleException e)
{
e.printStackTrace();
}
} --------------------编程问答-------------------- public void runJob(String jobname)
{
try
{
KettleEnvironment.init();// jobname 是Job脚本的路径及名称
JobMeta jobMeta = new JobMeta(jobname, null);
Job job = new Job(null, jobMeta);// 向Job 脚本传递参数,脚本中获取参数值:${参数名}
job.setVariable("TEST", "chensong");
job.start();
job.waitUntilFinished();
if (job.getErrors() > 0)
{
System.out.println("decompress fail!");
}
}
catch (KettleException e)
{
System.out.println(e);
}
}
public void runTrans(String filename) throws Exception
{
KettleEnvironment.init();
TransMeta transMeta = new TransMeta(filename);
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
trans.startThreads();
trans.waitUntilFinished();
if (trans.getErrors() != 0)
{
System.out.println("Error");
}
} --------------------编程问答-------------------- 问个问题,我的job内有一个“zip file”,这个zip file 有一个选项:压缩后自动删除原文件;可是我将kjb融入工程后,原文件删除失败,提示信息如下:
"无法删除文件 "file:///D:/GJ/Kettle/sjk/file:/D:/GJ/Kettle/sjk/1.del" ,用spoon执行该job时是可以删除的……
请问,为什么融入工程后就不能呢?可以确定路径没有错误……
补充:Java , Java相关