Reputation: 1182
I am trying to execute a docker command from within Java. The docker command needs to be executed in the specified directory.
I found this for executing an external command.
public Process exec(String command, String[] envp, File dir) throws IOException
I am unable to understand what exactly does this envp
String array is used for? The documentation reads as:
envp - array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.
But I am unable to understand what it exactly means in the documentation. Could someone explain it with an example? What exactly do you need to pass as an argument here.
P.s.: I am using a *nix environment for dev/deployment.
Upvotes: 0
Views: 603
Reputation: 34920
envp
- this is an abbreviation, I guess, from environment parameters (or variables). For instance it can be path to libraries or something else.
If you do not need specify them, than pass it as null
Runtime.getRuntime().exec(command, null, dir);
Upvotes: 1