使用ant構建JSGFDemo時,一切正常。運行JSGFDemo.jar構建工件沒有任何錯誤。然而,使用在eclipse導入的源文件夾時,並添加在lib /目錄的罐子到構建路徑,使用以下信息的程序中的錯誤:獅身人面像語法位置無法找到資源
Problem configuring recognizerProperty exception component:'jsgfGrammar' property:'grammarLocation' - Can't locate resource:/edu/cmu/sphinx/demo/jsapi/jsgf/
edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource:/edu/cmu/sphinx/demo/jsapi/jsgf/
出於某種原因,在ConfigurationManagerUtils.resourceToURL(String location)
看似返回調用ConfigurationManagerUtils.class.getResource(resourceName);
location =「resource:/ edu/cmu/sphinx/demo/jsapi/jsgf /」的不同結果。 (null,或者一個有效的URL對象)
作爲旁註,我認爲getResource(「/ path/to/a/dir/not/file /」);在它解析爲jar內的路徑時無效。
我一直對我的頭撞了一會兒,看不到我做錯了什麼。
缺少資源的唯一原因是缺少資源。這個錯誤意味着你的類路徑中沒有相應的路徑。可能您以不同的方式命名了該軟件包,並且未更改config.xml文件中的路徑。您需要提供更多關於您的項目佈局的信息,您的項目的文件結構是什麼等,才能獲得更有意義的答案。 –
@NikolayShmyrev從我可以告訴,罐子有相同的文件結構。看看他們,如果你想要的話:https://docs.google.com/file/d/0B4ayCXFZPsx8aU5DeGRXb1VpNm8/edit 我不明白如果我附加一些特定文件的文件名,但是,如資源:/ edu/cmu/sphinx/demo/jsapi/jsgf/commands.gram,但顯然這在sphinx嘗試引用資源時不起作用:/edu/cmu/sphinx/demo/jsapi/jsgf/command.gram/command 。公克 – remuladgryta