0

I want to include other supporting jars in particular jar. I have changed my manifest file as follows

Manifest-Version: 1.0

Archiver-Version: Plexus Archiver

Created-By: Apache Maven

Built-By: kedarj

Build-Jdk: 1.6.0_35

Class-Path: abc.jar xyz.jar commons-io-1.3.2.jar hibernate-c3p0-4.1.7.Final.jar javax.inject-1.jar spring-data-mongodb-1.0.3.RELEASE.jar hibernate-ehcache-4.1.7.Final.jar mysql-connector-java-5.1.6.jar ehcache-web-2.0.4.jar Cache-1.0.3.jar log4j-1.2.15.jar jackson-mapper-asl-1.9.10.jar slf4j-api-1.7.2.jar slf4j-log4j12-1.7.2.jar commons-lang-2.3.jar

Main-Class: abc.SomeClass

I have abc.jar as main jar and all others are supporting jars which are kept is same folder. Please help me out to set class-path correctly.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Kedar
  • 167
  • 1
  • 7
  • What's not working about it? It looks fine. Did you remember to add the next-line carriage at the end? – Paul Samsotha Jan 07 '14 at 06:24
  • Can you please explain?? how to add next-line carriage?? – Kedar Jan 07 '14 at 06:52
  • You need to have an extra line at the very end after `Main-Class: abc.SomeClass`. In the manifest, at the end of that line, just hit `ENTER` to make sure there is an extra line – Paul Samsotha Jan 07 '14 at 06:54
  • Can you please explain in brief what is correct way to write manifest for such scenario? – Kedar Jan 07 '14 at 07:01
  • Have a look at [**this answer**](http://stackoverflow.com/questions/10929438/create-jar-with-custom-manifest-with-multiple-libraries-in-classpath) and [**this answer**](http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath) and [**Working with Manifests**](http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html) from the Oracle tutorial – Paul Samsotha Jan 07 '14 at 07:06
  • How can I refer entire folder of jars to class path – Kedar Jan 07 '14 at 09:21

1 Answers1

1

The maximum characters in the classpath list per line should not exceed 72.

so use separate line after 72 character.

for eg.

Class-Path: abc.jar xyz.jar commons-io-1.3.2.jar hibernate-c3p0-4.1.7.Final.jar
  javax.inject-1.jar spring-data-mongodb-1.0.3.RELEASE.jar 

hope that helps.

Darshan Patel
  • 3,176
  • 6
  • 26
  • 49
  • I have declared each jar file to new line like this Class-Path: abc.jar xyz.jar commons-io-1.3.2.jar hibernate-c3p0-4.1.7.Final.jar javax.inject-1.jar spring-data-mongodb-1.0.3.RELEASE.jar But now I am getting error 'Invalid or corrupt jar file' – Kedar Jan 07 '14 at 06:44