Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class-Path Limits in Jar Manifest Files

 
Howard Thompson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Thanks
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic