• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

(weird?) NoSuchMethodError

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I am using Eclipse IDE.
In my project A, I am making use of another project B. So I made a jar of B and placed in A's build path. Now, when I make use of B's class, I am getting an NoSuchMethodError as follows:

Exception in thread "main" java.lang.NoSuchMethodError: org.semanticweb.owlapi.util.OWLEntityCollector.<init>(Ljava/util/Set;)V

I place OWL API jar file which supports that method i.e. OWLEntityCollector's constructor takes a parameter of type Set<Entity>. By default, in Eclipse, all the jars in the build path are in the classpath as well.

Where am I going wrong here? Please help.

 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That suggests that the version of the class the compiler used is not the same as the version the JVM is using, and the JVM is using one that doesn't have that constructor defined. If you've definitely put the right JAR file on the classpath, then maybe there's another JAR also containing that class that's causing a conflict.
 
Raghava Mutharaju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply.

You are right, there is indeed another jar which I make use of, that contains the same class minus the one parameter constructor. Now, how can I make sure that one jar is give precedence over the other jar? (in Eclipse and in general)
 
Raghava Mutharaju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I got it on how to set the jar precedence in Eclipse. How can I do that in ant build script? Rather than listing each jar, is there other way?
 
Goodbye moon men. Hello tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic