0

我正在尝试运行一个软件,我可以用它来建立一个实体是否是地理实体:

public boolean isgeo(String e) throws Exception{

    ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
    searchCriteria.setNameEquals(e);
    ToponymSearchResult searchResult = WebService.search(searchCriteria);
    entity = (ArrayList) searchResult.getToponyms();
    for (Toponym toponym : searchResult.getToponyms()) {
         System.out.println(toponym.getName()+" "+ toponym.getCountryName());
      }

    if(entity.size()>0)
        return true;
    else
        return false;

}

但是当我调用这个函数时,我有这些例外:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
at org.geonames.WebService.connectAndParse(Unknown Source)
at org.geonames.WebService.search(Unknown Source)
at geonames.utility.isgeo(utility.java:35)
at geonames.main.main(main.java:31)
Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

谁能帮我?

4

1 回答 1

1

你需要jdom-1.0 jar。不要下载任何其他版本,因为它不起作用。将此 jar 文件添加到您的项目中。

于 2012-12-27T03:30:31.050 回答