---
title: "Heritrix在windows下的配置步骤。"
author: "wiflish"
date: "2011-02-26T00:09:23Z"
tags: []
categories: ["互联网"]
slug: "heritrix-windows"
draft: false
lastmod: "2011-02-26T00:10:37Z"
id: 930606
url: "https://wiflish.iteye.com/blog/930606"
---

1. 下载Heritrix，地址：[http://nchc.dl.sourceforge.net/project/archive-crawler/archive-crawler%20%28heritrix%201.x%29/1.14.4/heritrix-1.14.4.zip](http://nchc.dl.sourceforge.net/project/archive-crawler/archive-crawler%20%28heritrix%201.x%29/1.14.4/heritrix-1.14.4.zip)

 

2. 解压heritrix-1.14.4.zip

 

3\. 设置环境变量：HERITRIX\_HOME

 

4\. 在命令行窗口，进入%HERITRIX\_HOME%\\bin目录，执行 heritrix.bat，出现类似如下字样的提示信息：

 

```
You have to specify either a username and password for the
web interface or start Heritrix without the web ui.

Example: heritrix --admin=admin:letmein
         heritrix --nowui myOrder.xml
```

 

 

5\. 根据提示，把命令修改为： heritrix --admin=admin:123，出现类似如下字样的提示信息：

```
WARNING: It's currently not possible to run Heritrix in background
         on Windows. It was just started minimized in a new Window
         and will be shut down as soon as you log off.

2011/02/25 周五 23:49:27.00 Starting heritrix

Heritrix failed to start properly. Possible causes:

- Login and password have not been specified (see --admin switch)
- another program uses the port for the web UI (8080 by default)
  (e.g. another Heritrix instance)
- JMX password file is missing or permissions not set correctly


JMX permissions file missing. A template can be found in
  E:\framework\heritrix-1.14.4\conf\jmxremote.password.template.
Copy it to
  E:\framework\heritrix-1.14.4\jmxremote.password
and edit the passwords at the end of the file. Then, make sure
the file is read-restricted to only the user that the Heritrix
Java VM will run as. For example:
```

 

 

6\. 根据提示，把%HERITRIX\_HOME%\\conf\\jmxremote.password.template文件复制到%HERITRIX\_HOME%\\目录下，并将文件重命名为：jmxremote.password，用文本编辑器打开文件，根据文件内的提示，将文件最后两行的@PASSWORD@，替换为想要的密码字符串。

 

```
monitorRole  123
controlRole  123
```

 

 

7\. 再设置文件的为只读，并且要设置文件的拥有者只能为当前登录系统的用户，删除文件的其他用户或角色权限。修改方法：

   文件-&gt;属性-&gt;"安全"标签页-&gt;高级-&gt;"权限"标签页-&gt;更改权限按钮

    -&gt;取消"包括从该对象的父项继承的权限"的勾选-,同时再删除其他多余的用户或角色权限(只留下当前登录系统的用户)

 

8\. 再次：heritrix --admin=admin:123，在弹出的cmd命令窗口中看到：

```
16:08:27.117 EVENT  Starting Jetty/4.2.23
16:08:27.164 WARN!! Delete existing temp dir C:\Users\wiflish\AppData\Local\Temp
\Jetty_127_0_0_1_8080__ for WebApplicationContext[/,jar:file:/E:/framework/herit
rix-1.14.4/webapps/admin.war!/]
16:08:27.256 EVENT  Started WebApplicationContext[/,Heritrix Console]
16:08:27.323 EVENT  Started SocketListener on 127.0.0.1:8080
16:08:27.323 EVENT  Started org.mortbay.jetty.Server@13d93f4
2011-02-25 16:08:27.588 信息 thread-10 org.archive.crawler.Heritrix.postRegister
() org.archive.crawler:guiport=8080,host=wiflish-PC,jmxport=8849,name=Heritrix,t
ype=CrawlService registered to MBeanServerId=wiflish-PC_1298650106843, Specifica
tionVersion=1.4, ImplementationVersion=1.6.0_23-b05, SpecificationVendor=Sun Mic
rosystems
Heritrix version: 1.14.4
```

 

 

配置成功