Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Class-Path ignored in MANIFEST.MF

Posted on 2003-03-18
12
Medium Priority
?
768 Views
Last Modified: 2007-12-19
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

0
Comment
Question by:Cressie176
11 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 8160366
 What is the error message you are getting?
0
 

Author Comment

by:Cressie176
ID: 8160399
Doh!

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/MQMD
0
 
LVL 35

Expert Comment

by:girionis
ID: 8160452
 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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Cressie176
ID: 8160530
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)
0
 
LVL 35

Expert Comment

by:girionis
ID: 8160593
 You can always unpack the external jar files and pack everything into a single jar.
0
 

Author Comment

by:Cressie176
ID: 8160647
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.
0
 
LVL 35

Accepted Solution

by:
girionis earned 300 total points
ID: 8160707
 Ok then in your manifest file change this line:

Class-Path: com.ibm.mq.jar jakarta-regexp-1.2.jar

  to this:

Class-Path: com/ibm/mq.jar jakarta-regexp-1.2.jar

  and tell me what happens.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8160726
 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
0
 
LVL 35

Expert Comment

by:girionis
ID: 8160732
 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).
0
 

Expert Comment

by:CleanupPing
ID: 9058616
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.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9727112
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question