Problem with JARs and External Libraries

Hi,

My problem is: I have a Eclipse project that uses external libraries (in the project properties--> Java Build Path --> Libraries I add all the jars I need and then they appear in my project with a white simbol) and it works running in Eclipse ( My project have a fold called "lib" containing all the libraries' jars). I want to export my project into a executable .jar

Firstly I exported the projecte into a .jar, and it makes a MANIFEST file:

Manifest-Version: 1.0

Main-Class: control.Launch

I tried to run with "java -jar MentalPoker.jar" but it said me that :

Exception in thread "main" java.lang.NoClassDefFoundError: iaik/me/security/CryptoException

I search in a lot of forums. A lot of people had this problem and de solution was to modify the MANIFEST and to use it at the moment to export (I specify in Eclipse that I want to use an existing manifest in worspace)

Manifest-Version: 1.0

Main-Class: control.Launch

Class-Path: lib/cldcapi11.jar lib/iaik_jce_full_me.jar lib/kxml.zip lib/midpapi20.jar lib/mysql-connector-java-3.1.12-bin.jar

but it dosn't work :( I run the .jar and the console say me the same initial problem:

Exception in thread "main" java.lang.NoClassDefFoundError: iaik/me/security/CryptoException

The libraries isn't found...

what can I do?

Thanks!

[1387 byte] By [Alaisa] at [2007-11-27 0:49:35]
# 1
Are the libraries in the correct paths - ./lib? And how do you execute the JAR?
CeciNEstPasUnProgrammeura at 2007-7-11 23:19:11 > top of Java-index,Java Essentials,Java Programming...
# 2

I execute the JAR by command line, I go to the path that contains the file and then write "java -jar MentalPoker.jar":

C:\Documents and Settings\Suu\Escritorio\PFC>java -jar MentalPoker.jar

Exception in thread "main" java.lang.NoClassDefFoundError: iaik/me/security/CryptoException

the IAIK is the cryptographic library that I need to use and it doesn't find.

My data follow this escructue:

-A fold called MentalPoker (this fold is the project's fold) that contains:

-".settings" fold

-"class" fold that contains all the .class

-"lib" that contains all the libraries that I have exported to my project

-"metadata" that contains a .sql file

-"src" that contains all .java files (contains the folds: utilities, files, exceptions, dataStructures, dao, files and control )

-a file named ".classpath"

-a file name ".project"

that's all

when I do the .jar and I open it with winrar and I saw this estructure:

-utilities fold

-files fold

-exceptions fold

-dataStructures fold

-dao fold

-control fold

-files fold

and META-INF fold that contains de MANIFEST

that's all

do you know what can be the problem?

Thanks

Alaisa at 2007-7-11 23:19:11 > top of Java-index,Java Essentials,Java Programming...
# 3

Sorry, the .jar has got more folds...

when I do the .jar and I open it with winrar and I saw this estructure:

-utilities fold

-files fold

-exceptions fold

-dataStructures fold

-dao fold

-control fold

-files fold

-META-INF fold that contains de MANIFEST

-lib fold containing all the .jar libraries

-metadata fold

if I open the MANIFEST that the .jar contains... I see that it not contains the Class-Path, only the version and the main-class. Why? The metadata that I use to generate the JAR contains Class-Path!!

Alaisa at 2007-7-11 23:19:11 > top of Java-index,Java Essentials,Java Programming...
# 4

I don't understand why the MANIFEST file that I use to export my project is diferent that the MANIFEST file that the JAR contains.

I use:

Manifest-Version: 1.0

Main-Class: control.Launch

Class-Path: lib/cldcapi11.jar lib/iaik_jce_full_me.jar lib/kxml.zip lib/midpapi20.jar lib/mysql-connector-java-3.1.12-bin.jar

and the JAR has got only:

Manifest-Version: 1.0

Main-Class: control.Launch

And... now my .JAR has got all the libraries' jars inside. it is incorrect?

if it isn't incorrect... why can I do?

thanks!

Alaisa at 2007-7-11 23:19:11 > top of Java-index,Java Essentials,Java Programming...
# 5
I have found the aswer.My problem was: the MANIFEST file must ends with a white line or a return!!!!
Alaisa at 2007-7-11 23:19:11 > top of Java-index,Java Essentials,Java Programming...