花了一个晚上的时间弄了下hadoop的编译环境,碰到些错误,这里保存下。

需要编译Hadoop,不但需要安装Maven,还需要安装protobuf

安装Maven

  • 下载:apache-maven-3.0.5-bin.tar.gz
  • 解压:tar -zxvf apache-maven-3.0.5-bin.tar.gz
  • 设置环境变量,打开/etc/profile文件,添加
    • export MAVEN_HOME=/opt/apache-maven-3.0.5
    • export PATH=$PATH:$MAVEN_HOME/bin
  • 执行命令使之生效:source /etc/profile或者./etc/profile
  • 验证:mvn -v
安装protobuf
  • 解压:tar -zxvf protobuf-2.5.0.tar.gz
  • 进入安装目录,进行配置,执行命令,./configure
  • 安装命令:make & make check & make install
  • 验证:protoc --version

编译Hadoop

  • 配置MAVEN国内镜像配置,在${MAVEN_HOME}/conf/settings.xml内设置。
 <mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
  • 将Hadoop Project 导入到Eclipse

 Importing projects to eclipse

 When you import the project to eclipse, install hadoop-maven-plugins at first.

   $ cd hadoop-maven-plugins

   $ mvn install

 Then, generate eclipse project files.

   $ mvn eclipse:eclipse -DskipTests

 At last, import to eclipse by specifying the root directory of the project via

 [File] > [Import] > [Existing Projects into Workspace].
  • 出现问问题:
Exception in thread "main" java.lang.AssertionError: Missing tools.jar at: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/Classes/classes.jar. Expression: file.exists()
at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:395)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:683)
at org.codehaus.mojo.jspc.CompilationMojoSupport.findToolsJar(CompilationMojoSupport.groovy:371)
at org.codehaus.mojo.jspc.CompilationMojoSupport.this$4$findToolsJar(CompilationMojoSupport.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:78)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0(ScriptBytecodeAdapter.java:112)
at org.codehaus.mojo.jspc.CompilationMojoSupport.execute(CompilationMojoSupport.groovy:318)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

解决方法:http://www.tuicool.com/articles/7N7BruB

this is as the compiler needs a file named tools.jar but localted at classes.jar under dir Classes but found nothing.so u can do workaround:

cd `java_home`/
mkdir Classes
cd Classes
ln -s ../lib/tools.jar classes.jar

but u should know,in macbook,the command 'ln' is ONLY effect when u locate in the target dir,otherwise u will see:

cd `java_home`
mkdir Classes
ln -s lib/tools.jar Classes/classes.jar
# or:ln -s lib/tools.jar /absolute/path/to/Classes/classes.jar
cp Classes/classes.jar /tmp
Error:no such file or dir found

Hadoop 2.6.0编译on mac的更多相关文章

  1. CentOS7 Hadoop 3.1.0 编译安装

    1.配置环境变量 JAVA_HOME=/jdk1..0_131 ANT_HOME=/apache-ant- MAVEN_HOME=/apache-maven- FINDBUGS_HOME=/findb ...

  2. hadoop 2.2.0 编译报错: [ERROR] class file for org.mortbay.component.AbstractLifeCycle not found

    [ERROR]  class file for org.mortbay.component.AbstractLifeCycle not found 错误堆栈如下: [ERROR] COMPILATIO ...

  3. mac OS X Yosemite 上编译hadoop 2.6.0/2.7.0及TEZ 0.5.2/0.7.0 注意事项

    1.jdk 1.7问题 hadoop 2.7.0必须要求jdk 1.7.0,而oracle官网已经声明,jdk 1.7 以后不准备再提供更新了,所以趁现在还能下载,赶紧去down一个mac版吧 htt ...

  4. CentOS 6.4 64位 源码编译hadoop 2.2.0

    搭建环境:Centos 6.4 64bit 1.安装JDK 参考这里2.安装mavenmaven官方下载地址,可以选择源码编码安装,这里就直接下载编译好的wget http://mirror.bit. ...

  5. 64位CentOS上编译 Hadoop 2.2.0

    下载了Hadoop预编译好的二进制包,hadoop-2.2.0.tar.gz,启动起来后.总是出现这样的警告: WARN util.NativeCodeLoader: Unable to load n ...

  6. CentOS 64位上编译 Hadoop 2.6.0

    Hadoop不提供64位编译好的版本号,仅仅能用源代码自行编译64位版本号. 学习一项技术从安装開始.学习hadoop要从编译開始. 1.操作系统编译环境 yum install cmake lzo- ...

  7. linux编译64bitHadoop (eg: ubuntu14.04 and hadoop 2.3.0)

    Hadoop官网提供的编译好的hadoop-2.3.0.tar.gz二进制包是在32位系统上编译的,在64系统上运行会有一些错误,比如: WARN util.NativeCodeLoader: Una ...

  8. 在docker容器中编译hadoop 3.1.0

    在docker容器中编译hadoop 3.1.0 优点:docker安装好之后可以一键部署编译环境,不用担心各种库不兼容等问题,编译失败率低. Hadoop 3.1.0 的源代码目录下有一个 `sta ...

  9. Centos 6.5 X64 环境下编译 hadoop 2.6.0 --已验证

    Centos 6.5 x64 hadoop 2.6.0 jdk 1.7 protobuf-2.5.0 maven-3.0.5 set environment export JAVA_HOME=/hom ...

随机推荐

  1. Python调用C可执行程序(subprocess) 分类: python 服务器搭建 C/C++ shell 2015-04-13 21:03 87人阅读 评论(0) 收藏

    从Python 2.4开始,Python引入subprocess模块来管理子进程,以取代一些旧模块的方法:如 os.system.os.spawn.os.popen.popen2.commands. ...

  2. [ES7] Exploring ES2016 Decorators

    Original artial --> link How descorator looks like: @mydecorator function myFun(){ ... } Descorat ...

  3. oracle常用数据类型

    oracle中常用数据类型分为三大类:

  4. VS2010项目转化为VS2008项目

    第一步: 打开VS2010项目的SLN文件有如下代码: Microsoft Visual Studio Solution File, Format Version 11.00# Visual Stud ...

  5. WTL的核心机制

    WTL背景介绍 WTL是微软ATL开发组成员Nenad Stefanovic先生在ATL Windowing机制上发展起来的一整套GUI框架,运用template技术组织和创建GUI对象,构筑了精致的 ...

  6. GUI编程笔记(java)09:GUI控制文本框只能输入数字字符案例

    1.首先我们看看我的需求,如下: 控制文本框只能输入数字字符   2.源代码: package cn.itcast_07; import java.awt.FlowLayout; import jav ...

  7. Ionic 弹出窗

    Ionic弹窗服务允许程序创建.显示弹出窗口,需要用户继续响应. 弹窗系统支持更多灵活的构建alert(),prompt()和confirm()功能版本,以及用户习惯,除了允许查看完全自定义内容的的弹 ...

  8. Unity3D 关于声音MissingComponentException报错

    如果你遇到报错如下: MissingComponentException: There is no 'AudioSource' attached to the "Level-2-bg&quo ...

  9. Unity5.0 手动激活

    提供Unity5.0.1.f1(32-bit)下载http://pan.baidu.com/s/1bg5sDK 密码 ns75 有时候会发现,用激活工具是激活不了的,这个时候就要手动激活,其实个人觉得 ...

  10. ASP.NET MVC 自我总结的便捷开发实例

    前言 工作了这么久了,接触ASP.NET MVC已经很久了,一直都想总结一下它的一些实用的,经常使用的一些技巧,但是因为一直都很懒,也不想总结,所以一直都没有好好写出来,趁着现在有这种冲劲,那么就先把 ...