Results 1 to 11 of 11
  1. #1
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default Manifest file: line too long error

    When I try creating a jar file using eclipse which has a manifest file in it with a long list of jar files, I get an error saying line too long.

    Can you tell me how to get this working:


    Here is the list of jars files>>

    Class-Path: activation.jar antlr-2.7.6.jar aopalliance.jar aspectjrt.jar aspectjweaver.jar cglib-nodep-2.1_3.jar common-annotations.jar commons-collections-3.2.jar commons-dbcp-all-1.3.jar commons-lang-2.2.jar commons-logging.jar dom4j-1.6.1.jar hibernate3.jar hibernate-annotations.jar hibernate-commons-annotations.jar hibernate-entitymanager.jar jta-1.1.jar junit-4.4.jar log4j-1.2.15.jar mail.jar ojdbc14.jar org.springframework.asm-3.0.4.RELEASE.jar org.springframework.beans-3.0.4.RELEASE.jar org.springframework.context-3.0.4.RELEASE.jar org.springframework.context.support-3.0.4.RELEASE.jar org.springframework.core-3.0.4.RELEASE.jar org.springframework.jdbc-3.0.4.RELEASE.jar org.springframework.orm-3.0.4.RELEASE.jar org.springframework.transaction-3.0.4.RELEASE.jar persistence.jar slf4j-api-1.5.5.jar slf4j-log4j12-1.5.0.jar velocity-1.6.4.jar velocity-1.6.4-dep.jar velocity-tools-2.0.jar org.springframework.expression-3.0.4.RELEASE.jar org.springframework.aop-3.0.4.RELEASE.jar org.springframework.aspects-3.0.4.RELEASE.jar

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Straight from the manifest specification:

    Quote Originally Posted by manifest spec
    No line may be longer than 72 bytes (not characters), in its UTF8-encoded form. If a value would make the initial line longer than this, it should be continued on extra lines (each starting with a single SPACE).
    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default

    Thanks Jos for your feedback. I trimmed the lines and was able to successfully export the jar file.

    Now when I execute the jar file, I get the following error.
    D:\emailer>java -jar test.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org.springframework.c
    ontext.support.ClassPathXmlApplicationContext
    at com.abc.gip.mailer.Mailer.main(Mailer.java:17)

    Here is my code
    Java Code:
    public class Mailer {
    	
    	public static void main(String[] args) {
    		ClassPathXmlApplicationContext mailerBeanFactory =  
    			new ClassPathXmlApplicationContext("applicationContext.xml");
    		UsageService usageService = (UsageService)mailerBeanFactory.getBean("usageService");
    		MailService mailAgent = (MailService)mailerBeanFactory.getBean("mailService");
    		Calendar thisMonth = Calendar.getInstance();
    		Date toDate = DateUtils.truncate(thisMonth.getTime(), Calendar.MONTH);
    		Calendar lastMonth = thisMonth;
    		lastMonth.add(Calendar.MONTH, -1);
    		Date fromDate = DateUtils.truncate(lastMonth.getTime(), Calendar.MONTH);
    		mailAgent.sendMail(usageService.getUniqueUsages(fromDate, toDate));
    	}
    
    }
    and here is the manifest file

    Manifest-Version: 1.0
    Class-Path: lib/activation.jar lib/antlr-2.7.6.jar lib/aopalliance.jar
    lib/aspectjrt.jar lib/aspectjweaver.jar lib/cglib-nodep-2.1_3.jar lib
    /common-annotations.jar lib/commons-collections-3.2.jar lib/commons-d
    bcp-all-1.3.jar lib/commons-lang-2.2.jar lib/commons-logging.jar lib/
    dom4j-1.6.1.jar lib/hibernate3.jar lib/hibernate-annotations.jar lib/
    hibernate-commons-annotations.jar lib/hibernate-entitymanager.jar lib
    /jta-1.1.jar lib/junit-4.4.jar lib/log4j-1.2.15.jar lib/mail.jar lib/
    ojdbc14.jar lib/org.springframework.asm-3.0.4.RELEASE.jar lib/org.spr
    ingframework.beans-3.0.4.RELEASE.jar lib/org.springframework.context-
    3.0.4.RELEASE.jar lib/org.springframework.context.support-3.0.4.RELEA
    SE.jar lib/org.springframework.core-3.0.4.RELEASE.jar lib/org.springf
    ramework.jdbc-3.0.4.RELEASE.jar lib/org.springframework.orm-3.0.4.REL
    EASE.jar lib/org.springframework.transaction-3.0.4.RELEASE.jar lib/pe
    rsistence.jar lib/slf4j-api-1.5.5.jar lib/slf4j-log4j12-1.5.0.jar lib
    /velocity-1.6.4.jar lib/velocity-1.6.4-dep.jar lib/velocity-tools-2.0
    .jar lib/org.springframework.expression-3.0.4.RELEASE.jar lib/org.spr
    ingframework.aop-3.0.4.RELEASE.jar lib/org.springframework.aspects-3.
    0.4.RELEASE.jar
    Main-Class: com.abc.gip.mailer.Mailer

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Does the jar with that class exist in the Manifest?
    (regarding that, why split int he middle of file names? Why not simply put each jar on its own line (starting with a space)).

    Does the jar exist in <path to your jar>/lib/<spring jar file>?

  5. #5
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default

    Yes. Its referring to org.springframework.context-3.0.4.RELEASE.jar file which is present in the manifest run. Split in the file names is added by the eclipse tool only.

    Here is the basic structure of my jar file

    +-test.jar
    |-+-META-INF
    |-|----Manifest.mf
    |-+-com
    |-|-+-package
    |-|-|----My java files
    |-+-lib
    |-|-+-All jar files

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Tolls View Post
    Does the jar with that class exist in the Manifest?
    (regarding that, why split int he middle of file names? Why not simply put each jar on its own line (starting with a space)).
    Yep, what Tolls said.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    You can't stick jars in jars.

  8. #8
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default

    I got this to work by just placing all the jars under lib folder created at the same level from where I was trying to run the jar file

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Yep.
    Which is where you manifest is telling the JVM to find them.

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Bah!
    Double post!

  11. #11
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default

    Earlier I had all the jars placed inside /lib folder inside my test.jar which did not work. So I copied over all the external jars to my working folder too

Similar Threads

  1. manifest file problem
    By afraidofdark in forum Advanced Java
    Replies: 5
    Last Post: 03-27-2010, 01:58 PM
  2. Jar File Manifest
    By hitmen in forum New To Java
    Replies: 6
    Last Post: 03-11-2009, 05:08 AM
  3. Manifest file in executable jars
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-15-2007, 09:16 PM
  4. Replies: 1
    Last Post: 08-07-2007, 08:53 AM
  5. Error: convert from String to long
    By bbq in forum New To Java
    Replies: 1
    Last Post: 06-29-2007, 08:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •