Link to home
Start Free TrialLog in
Avatar of Cressie176
Cressie176

asked on

Class-Path ignored in MANIFEST.MF

Hi,

I'm newish to Java and trying to get to grips with manifest files. I have written a java application which works perfectly providing I don't compile everything into a jar e.g.

Works with

java -cp .;./com.ibm.mq.jar;./jakarta-regexp-1.2.jar PafClient

Doesn't work with

java -jar PafClient.jar


The contents of my jar is

PafClient.class
PafVO.class
com.ibm.mq.jar
jakarta-regexp-1.2.jar
META-INF/MANIFEST.MF


The contents of my manifest file is

Manifest-Version: 1.0
Created-By: Apache Ant 1.5.1
Main-Class: PafClient
Class-Path: com.ibm.mq.jar jakarta-regexp-1.2.jar


META-INF/MANIFEST.MF is all in caps
There is a blank line beneath Class-path
I am using JDK 1.3.1_03


Any help would be most appreciated as this is driving me nuts!!!

Steve

Avatar of girionis
girionis
Flag of Greece image

 What is the error message you are getting?
Avatar of Cressie176
Cressie176

ASKER

Doh!

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/MQMD
 You are missing the MQMD class. Try the following:

  java -cp .;./com.ibm.mq.jar;./jakarta-regexp-1.2.jar -jar PafClient.jar

  and tell me what happens.
Works fine.

However this doesn't help me package the external jars into the PafClient.jar so I can deploy with a single file.
(Sorry if I'm jumping the gun)
 You can always unpack the external jar files and pack everything into a single jar.
I thought of this, but I'd rather know how to do things properly. According to what I've read in the Manifest spec it should be possible.
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
 Not that your "mq.jar" file must be in the folder "com/ibm" which should be relative to the "PafClient.jar" file. If your PafClient.jar is under the /home/cressie176/classes then the mq.jar should be in the /home/cressie176/classes/com/ibm/mq.jar and your  jakarta-regexp-1.2.jar should be in the /home/cressie176/classes/ jakarta-regexp-1.2.jar
 Thsi:

> Not

  should be:

> Note

  and this:

>  /home/cressie176/classes/ jakarta-regexp-1.2.jar

  should be:

>  /home/cressie176/classes/jakarta-regexp-1.2.jar

  (no space before jakarta).
Cressie176:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept girionis' comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer