本文整理了Java中org.apache.tools.ant.taskdefs.Execute.getEnvironmentVariables()
方法的一些代码示例,展示了Execute.getEnvironmentVariables()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execute.getEnvironmentVariables()
方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Execute
类名称:Execute
方法名:getEnvironmentVariables
[英]Find the list of environment variables for this process.
[中]查找此过程的环境变量列表。
代码示例来源:origin: org.apache.ant/ant
/**
* Find the list of environment variables for this process.
*
* @return a vector containing the environment variables.
* The vector elements are strings formatted like variable = value.
* @deprecated use #getEnvironmentVariables instead
*/
@Deprecated
public static synchronized Vector<String> getProcEnvironment() {
Vector<String> v = new Vector<>();
getEnvironmentVariables().forEach((key, value) -> v.add(key + "=" + value));
return v;
}
代码示例来源:origin: org.apache.ant/ant
/**
* load the environment values
* @param prefix prefix to place before them
*/
protected void loadEnvironment(String prefix) {
Properties props = new Properties();
if (!prefix.endsWith(".")) {
prefix += ".";
}
log("Loading Environment " + prefix, Project.MSG_VERBOSE);
Map<String, String> osEnv = Execute.getEnvironmentVariables();
for (Map.Entry<String, String> entry : osEnv.entrySet()) {
props.put(prefix + entry.getKey(), entry.getValue());
}
addProperties(props);
}
代码示例来源:origin: org.apache.ant/ant
new LinkedHashMap<>(getEnvironmentVariables());
for (String keyValue : env) {
String key = keyValue.substring(0, keyValue.indexOf('='));
代码示例来源:origin: org.apache.ant/ant
Map<String, String> env = Execute.getEnvironmentVariables();
String path = env.get(PATH1);
if (path == null) {
代码示例来源:origin: org.apache.ant/ant
String path = getPath(Execute.getEnvironmentVariables());
if (path != null) {
p = new Path(getProject(), path);
代码示例来源:origin: org.rundeck/rundeck-core
/**
* @return local environment variables
*/
@SuppressWarnings("unchecked")
public static Map<String,String> loadLocalEnvironment(){
return (Map<String,String>)Execute.getEnvironmentVariables();
}
代码示例来源:origin: org.apache.ant/ant-junit
/**
* Adding ant runtime.
* @param cmd command to run
*/
private void checkIncludeAntRuntime(final CommandlineJava cmd) {
if (includeAntRuntime) {
final Map<String, String> env = Execute.getEnvironmentVariables();
final String cp = env.get(CLASSPATH);
if (cp != null) {
cmd.createClasspath(getProject()).createPath()
.append(new Path(getProject(), cp));
}
log("Implicitly adding " + antRuntimeClasses + " to CLASSPATH",
Project.MSG_VERBOSE);
cmd.createClasspath(getProject()).createPath()
.append(antRuntimeClasses);
}
}
内容来源于网络,如有侵权,请联系作者删除!