Here you can find the source of exec(String command, String[] args_, String[] environment)
Parameter | Description |
---|---|
command | The command to ecxecute. |
args_ | The arguments. |
environment | The environment key-value pairs. |
public final static Process exec(String command, String[] args_, String[] environment) throws java.io.IOException
//package com.java2s; //License from project: Apache License public class Main { /**// w w w . ja v a 2 s. c o m Executes the commands with args and environemnt in a separate process. @param command The command to ecxecute. @param args_ The arguments. @param environment The environment key-value pairs. @return The new process. */ public final static Process exec(String command, String[] args_, String[] environment) throws java.io.IOException { // setup params String[] args = new String[1]; if (args_ != null) { args = new String[args_.length + 1]; for (int i = 0; i < args_.length; i++) args[i + 1] = args_[i]; } // let's go... args[0] = command; // param debug /* for(int i = 0; i < args.length; i++) out.println("[" + i + "]" + args[i]); for(int i = 0; i < environment.length; i++) out.println("[" + i + "]" + environment[i]); */ // end of param debug return Runtime.getRuntime().exec(args, environment); } }