我试着在程序中内嵌一个浏览器,做一个简单的spider用于抓取一些运用ajax技术的网页。
但是在进行遇到了一些问题,在此向各位高手们请教,程序如下:package com.test.mo;import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;import org.mozilla.xpcom.GREVersionRange;
import org.mozilla.xpcom.Mozilla;
import org.mozilla.xpcom.XPCOMException;public class TestMo {
public static void main(String[] args) {
 Mozilla mozilla = null;
 GREVersionRange[] range = new GREVersionRange[1];
 range[0] = new GREVersionRange("1.9.0", true, "1.9", false);
 
 try {
File grePath =   new File("E:\\openSource\\xulrunner-sdk\\bin");
   Mozilla.getGREPathWithProperties(range, null);
   LocationProvider locProvider = new LocationProvider(grePath,null);
   mozilla.initEmbedding(grePath, grePath, locProvider);
   mozilla = Mozilla.getInstance();
   mozilla.initialize(grePath);
   mozilla.initEmbedding(grePath, grePath, locProvider);
 } catch (FileNotFoundException e) {
   // this exception is thrown if greGREPathWithProperties cannot find a GRE
 e.printStackTrace();
 } catch (IOException e) {
 e.printStackTrace();
 }
 catch (XPCOMException e) {
 e.printStackTrace();
   // this exception is thrown if initEmbedding failed
 }
}
}但是抛出:
java.io.FileNotFoundException: GRE not found
at org.mozilla.xpcom.Mozilla.getGREPathWithProperties(Mozilla.java:177)
at com.test.mo.TestMo.main(TestMo.java:19)我按照moillza官方网站将xulrunner注册了,并能在注册表中找到moillza.org/gre信息。