ExecutionUtils

Execution related methods. For example, to run a script or JAR. 

Methods

runScript

Description:

MethodReturn valuesDescription

runScript(File script)

Object[]

Execute script from file.

script: The name of the file to run.

Example:

package com.openkm;

import java.io.File;

import com.openkm.core.Config;
import com.openkm.util.ExecutionUtils;

public class Test {
	public static void main(String[] args) {
		try {
			File script = new File("/home/openkm/test.bsh");
			ExecutionUtils.runScript(script);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

runJar

Description:

MethodReturn valuesDescription

runJar(File jar)

Object

Execute jar from file.

jar: The name of the file to run.

Example:

package com.openkm;

import java.io.File;

import com.openkm.util.ExecutionUtils;

public class Test {
	public static void main(String[] args) {
		try {
			File jar = new File("/home/openkm/test.jar");
			ExecutionUtils.getInstance().runJar(jar);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

runCmd

Description:

MethodReturn valuesDescription

runCmd(String cmd)

CmdExecutionResult

Execute command line.

cmd: The command line to execute.

Example:

package com.openkm;

import com.openkm.util.ExecutionUtils;

public class Test {
	public static void main(String[] args) {
		try {
			ExecutionUtils.runCmd("mkdir test");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}