File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Class-Path Limits in Jar Manifest Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Class-Path Limits in Jar Manifest Files" Watch "Class-Path Limits in Jar Manifest Files" New topic

Class-Path Limits in Jar Manifest Files

Howard Thompson

Joined: Nov 06, 2002
Posts: 4
I have a Class-Path which has 11 jar files. If I use their real names, I go over what seems to be a line/character limit. The generated Manifest file from the jar command shows a cr lf having been injected. This results in part of the listed jar files not being included; those forced onto the second line. If I use an additional Class-Path statement, the last Class-Path statement becomes the only one that is used. If I simply put my list on 2 lines with just one Class-Path statement, the jar command indicates a syntax error. The only solution so far is to rename all the jar files to 1 1 character names as indicated below. It may also be possible to nest Class-Path references within the manifest files of the "sub"jars, so that the list at the top can be shortened.
There must be a better solution out there! The single character listing below does work however but there must be some special syntax to make this work with longer file names.
jar cvfm output.jar myManifest com *.jar
Manifest-Version: 1.0
Main-Class: com.mine.myclass
Class-Path: a.jar b.jar c.jar d.jar e.jar f.jar g.jar h.jar i.jar j.jar k.jar
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

I don't know if this solution will work or not, but how about compressing all these jar files in a single jar file and including it in the classpath?
- Manish
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

This is just a sample manifest file that I use; it has given me no problem:

I see the carraige returns in there, but it has given me no problem in actaully running -- this application is up and running with no problems.
Could this be a problem with different versions? I'm using 1.4.1_02, what java version are you using?

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: Class-Path Limits in Jar Manifest Files
jQuery in Action, 3rd edition