Search code examples
javajarclasspathmanifest

Too long line in manifest file while trying to create jar


I am getting a too long line error while trying to build a jar. the long line in the manifest file is the Class-Path line as the application uses a lot of third-party libraries. needless to say, I am using Windows :-( and Eclipse Java 1.6

I tried Class-Path: lib or Class-Path: lib/ but they did not work.


Solution

  • The classpath is too long due to the number of jar files in it. «No line may be longer than 72 bytes (not characters), in its UTF8-encoded form.» [from docs: java 5, java 8; «Line length» section].

    use as the following way to resolve the problem:

    (1) use separate lines, to avoid too long a line for java package name lists

    (2) type a preceding space before each folloing lines, for example:

    Class-Path:
     ...jar
     ...jar
     ...jar