• Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError getting in production but code is working fine in debug env  RSS feed

 
Sharad Kharya
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading an xml from my swing application using jdom.jar.

I am using Eclipse and Ant for build for development.
I had added the jar in java buildpath and also in ANT buildpath.

Code is compiling & also build.xml is executed successfully.
While debugging from Eclipse application is working fine and xml is read successfully.

But, when I am running my application from .exe(in jar format which contains all the class files of project),
It is giving RuntimeError :-
java.lang.NoClassDefFoundError: com/matrixone/jdom/input/SAXBuilder

I knew what this error means but this doesn�t seems as simple as its description is�

I had added jdom.jar path in environments variable entry also but still its giving same error.

Please let me know how to resolve this issue.

Note:- I solved it in below mentioned way.
Steps:-
Extract jdom.jar and add all the content in my project application.jar, and run the application.

In this case its working fine.
But as per my understanding this wont be the right approach, because later if I want to add other 3rd party jars then it�s not prefer to add the content of jars instead of looking them somewhere else.

Please help me in sorting out this issue.


Thanks in Advance
Sharad
[ November 08, 2008: Message edited by: Sharad Goluone ]
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question.
The "correct" way to do it is to add the external jar to the classpath; you can do that in the manifest file.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sharad Goluone:
java.lang.NoClassDefFoundError: com/matrixone/jdom/input/SAXBuilder

I'd check the JAR file, because the official class name is org.jdom.input.SAXBuilder - without the matrixone part.
 
Sharad Kharya
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Rob, by mistake i matrixone typed.
actually its giving error - com/jdom/input/SAXBuilder.

Campbell
I had updated the entry of external jar in environment variable classpath.
but didn,t added that in manifest file.

I'll try adding entry in manifest file..& hope will work properly.
I had already invested 2 days while working on this issue

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sharad Goluone:
Sorry Rob, by mistake i matrixone typed.
actually its giving error - com/jdom/input/SAXBuilder.

Note, it has to be org.jdom.input.SAXBuilder. Was "com" also a typing mistake? It's important to be precise in explaining exactly what you did and what the error message is, because the computer understands it only if you do it exactly right.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!