tags:

views:

29

answers:

1

Hi

I have a jar file called "a.jar" which has another jar file called "b.jar".

a.jar
 |
 |-- META-INF
 |     |
 |     |-- MANIFEST.MF
 |
 |-- b.jar
     |
     |- com/test/MainInB.class

"b.jar" has com/test/MainInB.class file. (MainInB class just print out "hello world!")

"a.jar" has the MANIFES.MF like this:

Manifest-version: 1.0
Main-Class: com.test.MainInB
Class-Path: b.jar

(The manifest file does end with empty new line)


And I would like to run the a.jar like this so it prints out "hello world!"

java -jar a.jar

But I got NoClassDefFoundError!

Please Help! Is this not allowed? Or am I missing something?

R Joe

A: 

Actually my example works!

I'm just having problem with my project in which I use maven-assembly-plugin to create jar and MANIFEST.MF.

Something must be off in the configuration or the plugin.

Thanks anyway guys!

Joe

joe
Sorry guys.. Ignore my answer above. That wasn't right. I think it's illegal to try to execute a class file which is inside the jar file of another jar file.
joe