Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / July 2006

Tip: Looking for answers? Try searching our database.

executing jar : NoClassDefError

Thread view: 
Leena - 18 Jul 2006 22:13 GMT
Hi,

I have made a jar file and I'm trying to execute the jar file, but it
gives me NoClassDefError. However, when I extract the jar file, I see
that class but, jar file in not able to find it.

The only different thing I'm doing is I've extracted another jar file
and added the content of that jar file in my jar. Since my project
needs to refer to another jar file, I had to extract the content of
that jar file and put it in my jar. This was suggested in previous
discussion.

Any suggestions, why jar is not able to find a class which I can see in
the jar?

Thanks,
Leena
Mark Hansen - 18 Jul 2006 22:42 GMT
> Hi,
>
[quoted text clipped - 13 lines]
> Thanks,
> Leena

Exactly how are you executing the application? Are you using the -jar
command-line option, as in:

  java -jar myjar.jar

or are you just using:

  java -classpath myjar.jar com.my.main.Class

Are you including any classpath?

If you're using the -jar command-line argument, do you have a
MANIFEST.MF file with a BaseClass entry? Can you show us the
file?

What class is the error reporting that it cannot find?
Leena - 18 Jul 2006 23:09 GMT
Hi Mark,

I found the problem!

I was wrongly creating the jar file. Even though, my jar file had all
the class file, I was creating a folder and was storing classes of the
"available" jar file in that folder. So at runtime, since the classes
were inside folder(the one that I created) one level down, jar could
not find classes and throw error.

Less learnt: If the jar file is not working, then extract the jar file
and check the folder structure. This might give you some clue.

Thanks Mark for you time,

Leena

> > Hi,
> >
[quoted text clipped - 30 lines]
>
> What class is the error reporting that it cannot find?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.