Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Classpath and compilation issues

Status
Not open for further replies.

Diancecht

Programmer
Jan 8, 2004
4,042
ES
Hi all.

Sometimes you spend a lot of time doing OO design, declaring interfaces, inventing new patterns, optimizing to the death and so on, and when everything is finished and tested, you find a stupid error that stops everything.

Well, that's what's happening to me, let's see if something here can help me.

I've developed some software that uses an external product in a form of a jar file. When I try to execute it, I get the second worse exception I think I can have: NoClassDefFoundError: product/classs.

At first I thought it was a classpath issue but the classpath is OK. In fact, other software using the same classpath is running.

Then I thought about an exportation problem so I imported the jar product into my IDE and re-exported. Same result. I've even tried to execute it inside the IDE. Same result.

What I don't understand is that the definition of a class can change and the compilation can still be ok. My next step will be re-import the jar, recompile and reexport, but if anyone has any hint, would be great.

Cheers,

Dian
 
You're not doing anything 'cute' with Classloaders are you?
 
'cute' - lol.

Dian,
I have found in the past that class version conflicts can result in "NoClassDefFoundError". For example, if you have a version of class Qqqq in a.jar and another different version in b.jar, and both jars are in your CLASSPATH, then this can cause problems (Especially with RMI stuff !).

Another possible is some JNI related resource that is included in a class, and the resource it depends upon can not be found (check your LD_LIBRARY_PATH if this is the case).

--------------------------------------------------
Free Database Connection Pooling Software
 
Thanks for the replies.

timw, I once had a problem wiht "cute" classloaders, so I never used them again :)

sedj, in this case the classpath is OK, that's what it's getting me mad. I tried to execeute it from the IDE, and that IDE doesn't take external jars.

I thought on the JNI stuff, but that should end in and UnsatisfiedLinkError or something similar.

Now I'm gonna recompile everything and let's see what happens.

Thanks again.

Dian
 
I had an issue with upper case/lower case package names once. The package names in the jar file were upper case, and I was importing the classes with a lower case package name. The compiler correctly found the package, but the class loader could not.

I was using the fatjar plugin for eclipse. This may not apply to you.
 
Thanks for the replies.

I didn't get the solution for the problem, but I found a way to avoid using that product, so everything is fine for the moment.

I'll investigate further about this at some time, and will post the conclusions.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top