..
> I have made a jar file and I'm trying to execute the jar file, but it
> gives me NoClassDefError.
....
> 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. ....
Other jars can be added to the classpath at runtime.
It is neither necessary, nor recommended, to 'rejar'
all resources into a single jar.
> Any suggestions, why jar is not able to find a class which I can see in
> the jar?
That probably depends a lot on the exact contents of the jar,
and the manifest file, neither of which we can see from here.
Why don't you upload the jar (how big is it?) to a free site and
let us have a look at it?
Andrew T.
Leena - 18 Jul 2006 23:16 GMT
Hi Andrew,
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 the clue.
Thanks Andrew for your time,
Leena
> ..
> > I have made a jar file and I'm trying to execute the jar file, but it
[quoted text clipped - 16 lines]
>
> Andrew T.
Andrew Thompson - 18 Jul 2006 23:38 GMT
> I found the problem!
Yay! Thanks for reporting the solution.
<snip>
> Thanks Andrew for your time,
You're welcome.
Andrew T.
Nigel Wade - 19 Jul 2006 14:18 GMT
> ..
>> I have made a jar file and I'm trying to execute the jar file, but it
[quoted text clipped - 4 lines]
>
> Other jars can be added to the classpath at runtime.
If it's a jar which is being executed via the -jar command line argument then
the classpath comes from the manifest of the specified jar, and can't be
modified at runtime. In this case the external jar needs to be added to the
classpath in the executable jar's manifest when it is built.

Signature
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
Carlus Henry - 20 Jul 2006 03:26 GMT
>> ..
>>> I have made a jar file and I'm trying to execute the jar file, but it
[quoted text clipped - 8 lines]
> modified at runtime. In this case the external jar needs to be added to the
> classpath in the executable jar's manifest when it is built.
I had a similar situation that may or may not help. I was building
entries in the MANIFEST.MF file through my ant build script. Well, what
I made a mistake and did was put a ":" at the end of my Built-By or some
other key value like that. It completely rendered my jar inoperable. I
got all kind of wacky strange errors.
Make sure that the MANIFEST.MF file is not breaking spec in some sort of
way.
Thanks
Carlus
> Hi,
>
[quoted text clipped - 13 lines]
> Thanks,
> Leena