2

I have created one manifest.jar which contains the jars that needs to be added in classpath for some other Jar. I tried using relative classpath as well in my manifest.mf but still these jars are not getting added in classpath or that jar which needs these jars is not picking the jars from manifest.

the manifest looks like :-

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Class-Path: abc.jar adc1.jar ../abc2.jar ../abc3.jar ../../lib/abc4.jar

So if my jar say "My.jar" needs these these jars in classpath. And i have created a manifest.jar from above manifest.mf.But still it is not picking these jars.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
jsc_1999841
  • 51
  • 1
  • 4
  • Does the line starting with `Class-Path` have a new-line at the end? AFAIR lacking one can cause the JVM to ignore the last line of the manifest. How was the manifest made? (I use Ant to create them, since it handles some of the fine details.) – Andrew Thompson Jan 22 '13 at 10:07
  • Are you running your application with java -jar command – Jayamohan Jan 22 '13 at 10:12
  • i have created this file manually. at the end of line class-path there is no new-line. also i am not running the application using java -jar – jsc_1999841 Jan 22 '13 at 10:13

2 Answers2

3

A possible reason is described in http://docs.oracle.com/javase/tutorial/deployment/jar/modman.html

Warning: The text file from which you are creating the manifest must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275
1

That's not allowed.... a jar can't contain other jars (if not exploded) look at: ClassPath in manifest does not work

Community
  • 1
  • 1