NetBeans找不到build.属性



我使用GATE从法语文档中提取文本。我已经在GATE GUI的Windows上遇到了TreeTaggerCygwin的问题,我通过将下面的行置于系统环境中而不是C:Cygwinbinsh.exe;C:cygwinbin来解决这个问题C:/cygwin2/bin/sh.exe;C:/cygwin2/bin和创建build.properties文件在GATE的根目录下,并把下面的行

run.shell.path: C:\cygwin2\bin\sh.exe

现在,我有我最喜欢的管道,它可以通过GATE GUI在法语文本上正常工作。我通过"Save Application state"保存了我的管道,我知道我想通过NetBeans加载它并执行它。

但是当Netbeans初始化GATE并加载我保存的管道并添加我的语料库和文档时,它找不到POS的cygwin路径。我得到了错误=193,我猜这意味着它找不到构建。sh.exe文件的寻址路径,以便TreeTagger标记。

这是我的代码:

public static void main(String[] args) throws Exception {
   CorpusController FrenchController;
   Gate.init();
   MainFrame.getInstance().setVisible(true);
   File GateHome = Gate.getGateHome();
   File FrenchGapp = new File(GateHome,"appTest.xgapp");
   FrenchController =   (CorpusController)PersistenceManager.loadObjectFromFile(FrenchGapp);
   Corpus corpus = Factory.newCorpus("TestCorpus");
   FrenchController.setCorpus(corpus);
   File docFile = new File("D:\Amin\Project\DropBox\Donnees\7_doc.xml"); 
   Document doc = Factory.newDocument(docFile.toURL(), "utf-8");   //encoding
   corpus.add(doc);
   FrenchController.execute();
   corpus.clear();
} 

------------------------ 误差在门后执行 ------------------------

C:GATEpluginsTagger_FrameworkresourcesTreeTaggertree-tagger-french-gate-utf8 C:UsersAminAppDataLocalTemptagger6897917088215914126.txt
Exception in thread "main" gate.creole.ExecutionException: java.io.IOException: Cannot run program "C:GATEpluginsTagger_FrameworkresourcesTreeTaggertree-tagger-french-gate-utf8": CreateProcess **error=193**, %1 is not a valid Win32 application
    at gate.taggerframework.GenericTagger.runTagger(GenericTagger.java:489)
    at gate.taggerframework.GenericTagger.execute(GenericTagger.java:245)
    at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
    at gate.creole.SerialController.runComponent(SerialController.java:221)
    at gate.creole.SerialController.executeImpl(SerialController.java:153)
    at gate.creole.SerialAnalyserController.executeImpl(SerialAnalyserController.java:125)
    at gate.creole.AbstractController.execute(AbstractController.java:75)
    at secondshot.SecondShot.main(SecondShot.java:84)
Caused by: java.io.IOException: Cannot run program "C:GATEpluginsTagger_FrameworkresourcesTreeTaggertree-tagger-french-gate-utf8": CreateProcess error=193, %1 is not a valid Win32 application
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
    at java.lang.Runtime.exec(Runtime.java:617)
    at gate.util.ProcessManager.runProcess(ProcessManager.java:84)
    at gate.util.ProcessManager.runProcess(ProcessManager.java:66)
    at gate.taggerframework.GenericTagger.runTagger(GenericTagger.java:478)
    ... 7 more
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:385)
    at java.lang.ProcessImpl.start(ProcessImpl.java:136)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
    ... 11 more

感谢您的宝贵时间

我认为,build.properties文件仅在运行GATE Developer时读取。参见文档http://gate.ac.uk/userguide/sec:gettingstarted:sysprop

…当使用GATE Embedded时,您可以设置这些属性的值在调用Gate.init()之前…

在您的应用程序中,您可以在调用FrenchController.execute()之前检查属性shell.path是否设置正确。打电话给System.getProperty("shell.path")看看…

如果不是,可以使用

设置该属性。
System.setProperty("shell.path", "C:\cygwin2\bin\sh.exe")

在代码的某个地方,在调用FrenchController.execute()之前。

或者在NetBeans中,您可以按照以下答案进行设置:https://stackoverflow.com/a/7839141/1857897

相关内容

  • 没有找到相关文章

最新更新