After Jar creation, when I call from another project gives me java.lang.NoClassDefFoundError

A

asfonseca

I'm using WebSphere.
I've create a java project, with one class, that has several methods.
Export it has a jar file. Then in another project add it in libraries has
an external jar file.
When I call methods from that class, it recognizes every method, and
compiles ok. When I try to run it it gives me
"java.lang.NoClassDefFoundError".
Can I create a jar file from a java project?
I'm doing something wrong, it's annoying me, because this jar file is
what's missing me to conclude this project.
Any ideas?
Thanxs
Antonio Fonseca
 
D

Davis

asfonseca said:
I'm using WebSphere.
I've create a java project, with one class, that has several methods.
Export it has a jar file. Then in another project add it in libraries has
an external jar file.
When I call methods from that class, it recognizes every method, and
compiles ok. When I try to run it it gives me
"java.lang.NoClassDefFoundError".
Can I create a jar file from a java project?
I'm doing something wrong, it's annoying me, because this jar file is
what's missing me to conclude this project.
Any ideas?
Thanxs
Antonio Fonseca

The java.lang.NoClassDefFoundError is the most irritating error you
can get. I have put together a White Paper on the issues using
packages in jar files. You can view it at
http://www.sqlmagic.com/resources/jarfiles.htm. Hope it helps.
 
M

Micha

asfonseca said:
I'm using WebSphere.
I've create a java project, with one class, that has several methods.
Export it has a jar file. Then in another project add it in libraries has
an external jar file.
When I call methods from that class, it recognizes every method, and
compiles ok. When I try to run it it gives me
"java.lang.NoClassDefFoundError".
Can I create a jar file from a java project?
I'm doing something wrong, it's annoying me, because this jar file is
what's missing me to conclude this project.
Any ideas?
Thanxs
Antonio Fonseca
Sounds like you only have set the Java Build Path of your second program. In
WebSphere you also have to set it on the classpath in the Launch
Configuration (if its a java application), on the classpath of the server or
as the Utilies Jar in the Ear.
 
A

asfonseca

Thanks all, for your reply.
After all it was much more simple, I've drag and drop my jar file, in the
“web content”\”WEB-INF\lib” folder. I thought that by adding the jar as an
external JAR, would do just find, I was wrong.
I don't know if this is the right way, but, i've run several tests, and
everything, seems to work great.
I'll stick with this.
Regards,
AntonioFonseca
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top