Windows下myeclipse 安装 Nutch1.2(终于找到个不报错的)

Windows下myeclipse 安装 Nutch1.2(终于找到个不报错的)

 

1.下载并安装cygwin,安装和环境配置不细说了。将%CYGWIN_HOME%\bin加到path中。 

2.导入到Eclipse中 

①在Eclipse中添加File > New > Project > Java project。 
project name随便,选择 “Create project from existing source” ,在browse中选nutch的解压路径,如D:\nutch-1.2 

②在“Add Class Folder” 中选择 conf 文件夹。 

③然后再定义一个“Default ouput folder” ,名称任意。注意不能选bin文件夹,因为如果选了bin文件夹做为Default output folder 编译时会清空该文件夹,bin下的其他文件会被删掉,导致其他问题。 

④Finish. 

3.修改Nutch的配置文件,这里以抓取www.163.com为例。 

①修改D:\nutch-1.2\conf下的nutch-site.xml配置

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet href="configuration.xsl"?>
  3. <!-- Put site-specific property overrides in this file. -->
  4. <configuration>

  5. <property>
  6.   <name>http.agent.name</name>
  7.   <value>nutch-1.2</value>
  8.   <description>HTTP 'User-Agent'</description>
  9. </property>

  10. <property>
  11.   <name>searcher.dir</name>
  12.   <value>D:\nutch-1.2\crawl</value>
  13.   <description>Path to root of crawl.</description>
  14. </property>

  15. </configuration>
复制代码

②修改在D:\nutch-1.2\conf下的crawl-urlfilter.txt

  1. # accept hosts in MY.DOMAIN.NAME
  2. +^http://([a-z0-9]*\.)*163.info/ 
  3. # skip everything else
复制代码

③修改D:\nutch-1.2\conf下的nutch-default.xml

  1. <property>
  2.   <name>plugin.folders</name>
  3.   <value>./src/plugin</value>
  4.   <description>Directories where nutch plugins are located.  Each
  5.   element may be a relative or absolute path.  If absolute, it is used
  6.   as is.  If relative, it is searched for on the classpath.</description>
  7. </property>
复制代码

④在D:\nutch-1.2\下,建立名为urls的文件夹,并在文件夹内建立url.txt的文本,写入

  1. http://www.163.com/
复制代码

4. 在Eclipse里运行Nutch 

①Run-open run dialog 

②name随便写 

③在main class填写

  1. org.apache.nutch.crawl.Crawl
复制代码

④arguments填写

  1. urls -dir crawl -depth 3 -topN 50
复制代码

⑤在VM arguments填写

  1. -Dhadoop.log.dir=logs -Dhadoop.log.file=hadoop.log
复制代码

OK,运行,看Nutch在爬啊爬啊。

 

 

转载于:https://www.cnblogs.com/cy163/archive/2013/02/14/2911112.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值