Results 1 to 11 of 11
- 02-01-2011, 07:47 AM #1
Member
- Join Date
- Sep 2008
- Posts
- 85
- Rep Power
- 0
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
- 02-01-2011, 08:41 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,422
- Blog Entries
- 7
- Rep Power
- 17
Straight from the manifest specification:
kind regards,
Originally Posted by manifest spec
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 02-01-2011, 09:52 AM #3
Member
- Join Date
- Sep 2008
- Posts
- 85
- Rep Power
- 0
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
and here is the manifest fileJava 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)); } }
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
- 02-01-2011, 10:13 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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>?
- 02-01-2011, 11:00 AM #5
Member
- Join Date
- Sep 2008
- Posts
- 85
- Rep Power
- 0
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
- 02-01-2011, 11:03 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,422
- Blog Entries
- 7
- Rep Power
- 17
- 02-01-2011, 11:22 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
You can't stick jars in jars.
- 02-01-2011, 02:09 PM #8
Member
- Join Date
- Sep 2008
- Posts
- 85
- Rep Power
- 0
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
- 02-01-2011, 02:20 PM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Yep.
Which is where you manifest is telling the JVM to find them.
- 02-01-2011, 02:30 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Bah!
Double post!
- 02-01-2011, 03:01 PM #11
Member
- Join Date
- Sep 2008
- Posts
- 85
- Rep Power
- 0
Similar Threads
-
manifest file problem
By afraidofdark in forum Advanced JavaReplies: 5Last Post: 03-27-2010, 12:58 PM -
Jar File Manifest
By hitmen in forum New To JavaReplies: 6Last Post: 03-11-2009, 04:08 AM -
Manifest file in executable jars
By Java Tip in forum Java TipReplies: 0Last Post: 12-15-2007, 08:16 PM -
Error: Cannot access protected member long getTimeInMillis() in class Calendar
By cachi in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 07:53 AM -
Error: convert from String to long
By bbq in forum New To JavaReplies: 1Last Post: 06-29-2007, 07:23 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks