Use Java to run kitchen

Cmd.java

package com.simonftxy.core;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;

public class Cmd {

	public static void main(String[] args) {
		String cmd = "cmd /c kitchen.bat /file:G:\\TDDOWNLOAD\\Dev\\Data_Integration\\ae_demo\\Sample.kjb /level:Detailed >> H:\\1.log";
		File execPath = new File("G:/TDDOWNLOAD/Dev/Data_Integration/pdi-4.3.0");
		try {
			Process pro = Runtime.getRuntime().exec(cmd, null, execPath);

			BufferedReader input = new BufferedReader(new InputStreamReader(pro.getInputStream(), "GB2312"));
			String msg = null;
			while ((msg = input.readLine()) != null) {
				System.out.println(msg);
			}

			int exitVal = pro.waitFor();
			System.out.println("Exited with error code: " + exitVal);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			System.out.println(e);
			e.printStackTrace();
		}
	}
}
 

你可能感兴趣的:(java,cmd,Kettle,Kitchen)