可执行文件调用

2014/3/28
相当于做一个web前端,然后调用galago返回的结果。
每次galago运行完之后会在galagosearch-1.01/galagosearch-core/target/appassembler/bin目录下生成一个galago文件(.bat是windows下),相当于一个可执行文件。调用该文件即可。

具体流程:

根据输入框的title,narrative生成xml格式的topics,然后调用galago,运行,输出结果到BSOrg中,然后解析得到id号,根据id找到xml(直接根据id号写出路径),取出里面的值,显示。

1、调用myeclipse环境下的galago函数不成功。或者换个galago调用。

Cannot run program "/home/zzj/Workspaces/MyEclipse": java.io.IOException: error=2, No such file or directory

在eclipse环境下调用成功

2、Cannot run program "/home/zzj/workspace/galagosearch-1.01/galagosearch-core/target/appassembler/bin/galago

调用之前,改变权限 chmod +x ./galago

3、发现小批量测试时,会出现错误。

    java.lang.NullPointerException

    java.io.File.(File.java:222)

    com.social.util.parseXml.parseXml(parseXml.java:18)

io输入流错误,解析类出错。因为测试所用的索引以及源xml都为小批量,结果BSOrg解析出来的id可能找不到xml的路径,解析函数输入路径就为空。

可以在File.class类中发现问题。if(pathname=null){throw new NullPointerException}

4、调用galago时,应为galago会将结果输出到BSOrg文件里,可能还没写就往下运行了,所以必须等这个函数执行完。采用进程的方法失败。从网上找了个方法成功。

调用一个外部程序进行相关操作,必须等这个外部程序运行结束了以后才能执行以下的语句。有什么函数可以检测这个外部进程是否结束?

Process proc=Runtime.getRuntime().exec("/home/zzj/workspace/galagosearch-1.01/galagosearch-core/target/appassembler/bin/galago  batch-search --index=/home/zzj/learn/galago/test/xxx_index --corpus=/home/zzj/learn/galago/test/xxx_corpus --count=10 --outpath=/home/zzj   /home/zzj/test.topics  -DentityExpansionLimit=1000000");  

try{  

   if(proc.waitFor()!=0)   {  

      System.err.println("exit   value   =   "+proc.exitValue());  

    }  

  }  

catch(InterruptedException   e)   {  

     System.err.println(e);  

 }

//继续自己的程序

5、batch-search用到的topics格式
    "writer-Readers group recommendations"
    Writer-readers

    klarsenmd

    I'm looking for something new and different to read, and as I have come to enjoy these little snippets of conversation, I'm willing to bet I'd like some of the literary offerings you all have out there.

Now, I know you aren't supposed to shamelessly plug yourselves here, but really, if I'm asking, I think it's ok.

Unlike myself (I've only ever gotten work related stuff published) some of you are real published authors, not hobby writers, and I want to read some of your works. Does anyone have a great suggestion for me from an author in this group? I'll read almost anything as long as it's good! (Does that make me sound cheap?)

Thanks!

Kami



经过测试,其中标签title、group、narrative必须有,但是可以为空。

6、当改完galago的程序时,必须mvn -clean、mvn-install、chmod +x ./galago

7、从BSOrg解析得到的id,遍历所有xml文件夹,找到路径,特别慢。根据id号自动生成。

猜你喜欢

转载自420532394.iteye.com/blog/2178186