Heritrix配置成eclipse项目时出现Failed to load properties file from filesystem or from cl

  这段时间准备好好研究一下Heritrix,好好读一下其源代码,然后根据自己的需要进行一些扩展。今天将Heritrix配置到eclipse中时出现了找不到资源文件的异常。

Exception in thread "main" java.io.IOException: Failed to load properties file from filesystem or from classpath. at org.archive.crawler.Heritrix.getPropertiesInputStream(Heritrix.java:925) at org.archive.crawler.Heritrix.loadProperties(Heritrix.java:863) at org.archive.crawler.Heritrix.containerInitialization(Heritrix.java:492) at org.archive.crawler.Heritrix.main(Heritrix.java:555)

 

   其异常应当是读取配置文件的位置有问题

 

 

Heritrix.class.getResourceAsStream(PROPERTIES_KEY);//heritrix.properties

 

 

  解决办法如下

Heritrix.class.getClassLoader().getResourceAsStream(PROPERTIES_KEY);

 

 

你可能感兴趣的:(java,eclipse,thread)