如何在win7下的eclipse中调试Hadoop2.2.0的程序

 我来答
千锋教育
2016-01-09 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
展开全部
eclipse中调试Hadoop2.2.0的程序的方法:
本地程序要check hadoop运行的环境:
private static String checkHadoopHome() {
// first check the Dflag hadoop.home.dir with JVM scope
//System.setProperty("hadoop.home.dir", "...");
String home = System.getProperty("hadoop.home.dir");

// fall back to the system/user-global env variable
if (home == null) {
home = System.getenv("HADOOP_HOME");
}

try {
// couldn't find either setting for hadoop's home directory
if (home == null) {
throw new IOException("HADOOP_HOME or hadoop.home.dir are not set.");
}

if (home.startsWith("\"") && home.endsWith("\"")) {
home = home.substring(1, home.length()-1);
}

// check that the home setting is actually a directory that exists
File homedir = new File(home);
if (!homedir.isAbsolute() || !homedir.exists() || !homedir.isDirectory()) {
throw new IOException("Hadoop home directory " + homedir
+ " does not exist, is not a directory, or is not an absolute path.");
}

home = homedir.getCanonicalPath();

} catch (IOException ioe) {
if (LOG.isDebugEnabled()) {
LOG.debug("Failed to detect a valid hadoop home directory", ioe);
}
home = null;
}
//固定本机的hadoop地址
home="D:\\hadoop-2.2.0";
return home;
}
2、点击run as就可以直接调试了 。
zxh4567
2015-02-05 · TA获得超过6.1万个赞
知道大有可为答主
回答量:2.2万
采纳率:83%
帮助的人:1.3亿
展开全部
  如何eclipse中调试hadoop2.2.0,如果你使用的还是hadoop1.x的版本,那么,也没事,散仙在以前的博客里,也写过eclipse调试1.x的hadoop程序,两者最大的不同之处在于使用的eclipse插件不同,hadoop2.x与hadoop1.x的API,不太一致,所以插件也不一样,我们只需要使用分别对应的插件即可.
  方法如下:

  进入wordpress后台,Jetpack,点分享的配置,选择 Add a new service,
  server name 一定要写英文不能写中文,不然就崩溃了,如douban,
  private static String checkHadoopHome() {

  // first check the Dflag hadoop.home.dir with JVM scope
  //System.setProperty("hadoop.home.dir", "...");
  String home = System.getProperty("hadoop.home.dir");

  // fall back to the system/user-global env variable
  if (home == null) {
  home = System.getenv("HADOOP_HOME");
  }

  try {
  // couldn't find either setting for hadoop's home directory
  if (home == null) {
  throw new IOException("HADOOP_HOME or hadoop.home.dir are not set.");
  }

  if (home.startsWith("\"") && home.endsWith("\"")) {
  home = home.substring(1, home.length()-1);
  }

  // check that the home setting is actually a directory that exists
  File homedir = new File(home);
  if (!homedir.isAbsolute() || !homedir.exists() || !homedir.isDirectory()) {
  throw new IOException("Hadoop home directory " + homedir
  + " does not exist, is not a directory, or is not an absolute path.");
  }

  home = homedir.getCanonicalPath();

  } catch (IOException ioe) {
  if (LOG.isDebugEnabled()) {
  LOG.debug("Failed to detect a valid hadoop home directory", ioe);
  }
  home = null;
  }
  //固定本机的hadoop地址
  home="D:\\hadoop-2.2.0";
  return home;
  }

  转载,仅供参考。
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
星团联盟无聊的
2015-02-05 · TA获得超过1352个赞
知道小有建树答主
回答量:700
采纳率:0%
帮助的人:336万
展开全部
private static String checkHadoopHome() {

// first check the Dflag hadoop.home.dir with JVM scope
//System.setProperty("hadoop.home.dir", "...");
String home = System.getProperty("hadoop.home.dir");

// fall back to the system/user-global env variable
if (home == null) {
home = System.getenv("HADOOP_HOME");
}

try {
// couldn't find either setting for hadoop's home directory
if (home == null) {
throw new IOException("HADOOP_HOME or hadoop.home.dir are not set.");
}

if (home.startsWith("\"") && home.endsWith("\"")) {
home = home.substring(1, home.length()-1);
}

// check that the home setting is actually a directory that exists
File homedir = new File(home);
if (!homedir.isAbsolute() || !homedir.exists() || !homedir.isDirectory()) {
throw new IOException("Hadoop home directory " + homedir
+ " does not exist, is not a directory, or is not an absolute path.");
}

home = homedir.getCanonicalPath();

} catch (IOException ioe) {
if (LOG.isDebugEnabled()) {
LOG.debug("Failed to detect a valid hadoop home directory", ioe);
}
home = null;
}
//固定本机hadoop址
home="D:\\hadoop-2.2.0";
return home;
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式