wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Eclipse Importing Jar files - NoClassDefFoundError - did I miss something? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Eclipse Importing Jar files - NoClassDefFoundError - did I miss something?" Watch "Eclipse Importing Jar files - NoClassDefFoundError - did I miss something?" New topic
Author

Eclipse Importing Jar files - NoClassDefFoundError - did I miss something?

Tim Yuan
Greenhorn

Joined: Jul 27, 2006
Posts: 2
I am trying to import some Crystal Reports JAR files into my application. I am using IBM Rational Application Developer 6 (eclipse) and I am importing them by selecting my Application and going:

----
Project > Properties > Java Build Path > Libraries > Add External JARs
----

Then selecting the Crystal Reports JAR files I am looking to import. However when I try to run my App to display a Monthly Report I get the following error:

----
Exception: MonthlyReport: java.lang.NoClassDefFoundError: com/crystaldecisions/sdk/occa/report/lib/ReportSDKException
----

As far as I can tell it's a NoClassDefFoundError saying that it can't find the JAR files that i just specified. For reference the code works on other machines running RAD6 which has had the crystal Jars added in a similar manner, as well as when I push the code to my test server. Thus I surmised that it is definitely an environment problem.

This is a simple problem that I just can't seem to figure out, anybody have any ideas?

Thanks,
-Tim
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
it can not find the class named in the exception. this means it is not on the classpath... are you sure you've got all the correct jars on the path ?
are you sure the class is in one of these jars ? do you have different versions of the jar files and the class got renamed ?

to check if the class is in the jar file just extract the jar file (JAR is just a ZIP file so you can use Winzip or unzip or StuffIt or ...) and see if you can find the class.


pascal
Tim Yuan
Greenhorn

Joined: Jul 27, 2006
Posts: 2
Yes the JAR files do contain what I need. I upgraded to a new computer and at the same time migrated from Websphere application developer 5.1 to their new RAD 6.0 (basically different versions of eclipse). I copied the jar files over directly and they were working on the other computer.

To setup the classpath to the JAR files in RAD6, I believe is the process that I mentioned in the original post. I could be wrong though, this has been frustrating and i probably missed something somewhere, so if anybody can see where I went wrong I would be greatful.
Stu Thompson
Hooplehead
Ranch Hand

Joined: Jun 14, 2006
Posts: 136
I had a similar problem recently mantaining someone else's code that I brought into Eclipse. It turned out that the ant build was placing my project's jar into the same directory as my external jars. When setting up the project I had inadvertently used this directory and -all- the jars in it including the project's own output jar to include in the project.

Point being, make sure your project's output jar is not being imported.

(I feel incredibly stupid even letting you all know this happened. Shame.)


"This is not to say that design is unnecessary. But after a certain point, design is just speculation." --Philip Chu
 
wood burning stoves
 
subject: Eclipse Importing Jar files - NoClassDefFoundError - did I miss something?