我正在尝试使用 crawler4j,就像在此示例中使用的那样,无论我如何定义爬虫的数量或更改根文件夹,我都会继续从代码中收到此错误:
“需要的参数:rootFolder(它将包含中间爬取数据)numberOfCralwers(并发线程数)”主要代码如下:
public class Controller {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Needed parameters: ");
System.out.println("\t rootFolder (it will contain intermediate crawl data)");
System.out.println("\t numberOfCralwers (number of concurrent threads)");
return;
}
/*
* crawlStorageFolder is a folder where intermediate crawl data is
* stored.
*/
String crawlStorageFolder = args[0];
/*
* numberOfCrawlers shows the number of concurrent threads that should
* be initiated for crawling.
*/
int numberOfCrawlers = Integer.parseInt(args[1]);
有一个类似的问题问我到底想知道什么,但我不太明白解决方案,比如我在哪里输入java BasicCrawler Controller "arg1" "arg2"。我在 Eclipse 上运行这段代码,但我对编程世界还是很陌生。如果有人帮助我理解这个问题,我将不胜感激