user1534615
user1534615

Reputation: 101

Java code in Netbeans works but executing jar through cmd prompt gives nosuchmethod error exception

i have made a Java program in Netbeans to edit Excel file using poi libraries the code works fine in Netbeans but after building the jar file and executing it through command prompt gives a error when a call to some function is made that is there is external jar.

However i have included the target code in bulid.xml.. the jar file created in store also doesnot work and also the jar file created in dist folder also gives this error:

Exception in thread "AWT-EventQueue-0" java.lang.Nosuchmethoderror: org.apache.xmlbeans.xmloptions.setsaveaggresivenamespaces()Lorg/apache/xmlbeans/xmloptions;

I have checked the class org.apache.xmlbeans.xmloptions is present in the jar file.

Any thoughts?

Upvotes: 0

Views: 288

Answers (1)

kosa
kosa

Reputation: 66657

Exception in thread "AWT-EventQueue-0" java.lang.Nosuchmethoderror: 

It seems you have wrong version of jars in classpath. Either lower version (or) higher version of jar than your code.

i have checked the class org.apache.xmlbeans.xmloptions

It is not complaining about class not found, but it is saying the class available in classpath has different method signature than what you are calling in your code.

Example: Jar has method add(int a, int b); but your code calling(int a);

Upvotes: 1

Related Questions