在windows版本下的eclipse中连接hadoop2.2跑job

首先要重写在YARNRUNNDER.java这个类

将350行改成ContainerLaunchContext amContainer = ContainerLaunchContext.newInstance(localResources, replaceEnvironment(environment),
vargsFinal, null, securityTokens, acls);

private Map<String, String> replaceEnvironment(Map<String, String> environment) {
 String tmpClassPath = environment.get("CLASSPATH");
 tmpClassPath=tmpClassPath.replaceAll(";", ":");
 tmpClassPath=tmpClassPath.replaceAll("%PWD%", "\\$PWD");
 tmpClassPath=tmpClassPath.replaceAll("%HADOOP_MAPRED_HOME%", "\\$HADOOP_MAPRED_HOME");
 tmpClassPath=tmpClassPath.replaceAll("%HADOOP_CONF_DIR%", "\\$HADOOP_CONF_DIR");
 tmpClassPath=tmpClassPath.replaceAll("%HADOOP_COMMON_HOME%", "\\$HADOOP_COMMON_HOME");
 tmpClassPath=tmpClassPath.replaceAll("%HADOOP_HDFS_HOME%", "\\$HADOOP_HDFS_HOME");
 tmpClassPath=tmpClassPath.replaceAll("%HADOOP_YARN_HOME%", "\\$HADOOP_YARN_HOME");
 tmpClassPath= tmpClassPath.replaceAll("\\\\", "/" );
 environment.put("CLASSPATH",tmpClassPath);
 return environment;
}

你可能感兴趣的:(hadoop)