geonames exception - Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder

2.7k Views Asked by At

I am trying to run a piece of software with which I can estabilish if an entity is geographical or not:

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;

}

but when I call this function I have these exceptions:

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)

Can anyone help me?

1

There are 1 best solutions below

0
On

you need jdom-1.0 jar. do not download any other version because it will not work. add this jar file to your project.