01: package org.obe.runtime.tool;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05:
06: import java.io.IOException;
07: import java.util.Arrays;
08:
09: /**
10: * @author Adrian Price
11: */
12: public class NativeExecutableLauncher {
13: private static Log _logger = LogFactory
14: .getLog(NativeExecutableLauncher.class);
15:
16: public static void main(String[] args) {
17: if (_logger.isDebugEnabled()) {
18: _logger.debug(NativeExecutableLauncher.class.getName()
19: + ".main(" + Arrays.asList(args) + ')');
20: }
21:
22: String cmd = args[0];
23: String[] cmdArgs;
24: if (args.length <= 1) {
25: cmdArgs = null;
26: } else {
27: cmdArgs = new String[args.length - 1];
28: System.arraycopy(args, 1, cmdArgs, 0, args.length - 1);
29: }
30: try {
31: Runtime.getRuntime().exec(cmd, cmdArgs);
32: } catch (IOException e) {
33: _logger.error("Error invoking native executable '" + cmd
34: + "' with arguments: " + Arrays.asList(cmdArgs), e);
35: }
36: }
37:
38: private NativeExecutableLauncher() {
39: }
40: }
|