Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Creating fat jar(In the IDE the software is working, in fat jar doesn't find class)
Creating fat jar [message #631640] Fri, 08 October 2010 05:50 Go to next message
Eclipse UserFriend
HI,

I'm developing a simple software that produces report using jasperreports. To create the report in PDF format, the iText library is included. I'm using Eclipse and fat jar plugin to create a single executable jar. When I run the software in Eclipse (without creating the jar), everything is fine. When I create the fat jar, I got the error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/lowagie/text/pdf/FontMapper at net.sf.jasperreports.engine.JasperExportManager.exportReport ToPdfFile(JasperExportManager.java:117)

So I thoght: "Ok, the iText library is not included in fat jar". But it is not so! It's included! is there, there inside with everything it needs. I exploded the jar and found it! So I'm wondering why in Eclipse IDE it works and running the fat jar not!

Re: Creating fat jar [message #631655 is a reply to message #631640] Fri, 08 October 2010 07:54 Go to previous messageGo to next message
Eclipse UserFriend
If the .jar files are in the build path inside Eclipse, it will set things up correctly and that's why it runs successfully.

If it's not a web application, then maybe fat jar is not setting things up correctly. Have you tried to run the application from the command line with the iText and Jasper jars outside your jar, just setting the classpath properly? I've tried once to run a Java application with all its dependencies inside one jar with no success, even setting the Class-Path inside the MANIFEST.MF file correctly. Maybe you should contact the developers responsible for the plugin or check their Forums/FAQs.
Re: Creating fat jar [message #631676 is a reply to message #631655] Fri, 08 October 2010 08:56 Go to previous messageGo to next message
Eclipse UserFriend
Well, yes I tryied to keep library outside the jar, but I get the same result. Moreover, in the fat jar is included a postgres jdb connection library. Well, that library is correctly seen inside the jar, but the other library (iText) not! This is driving me crazy! It make no sense! The manifest just have nothing inside. Anyway thank you for your answer.
Re: Creating fat jar [message #631682 is a reply to message #631655] Fri, 08 October 2010 09:17 Go to previous messageGo to next message
Eclipse UserFriend
Ok. I found the problem (unbelievable...!)

Eclipse is working with jre1.6.0_15 (see menu windows->preferences and then select the node tree Java->Installed jres) while the system (I'm using Ubuntu) works with jre1.6.0_20. Changing the jvm in Eclipse I get the same problem. Executing tha fat jar with jvm 1.6.0_15 everything works! That probably means that iText library was built with a preceding jvm with respect to 1.6.0_20.

Hope this will help others...


Re: Creating fat jar [message #631773 is a reply to message #631682] Fri, 08 October 2010 13:02 Go to previous message
Eclipse UserFriend
Are you sure you haven't installed some jar files in the lib/ext directory of the 0_15 vm that aren't installed in the other vm?
Previous Topic:Technology
Next Topic:Type of a field
Goto Forum:
  


Current Time: Tue Jul 08 09:31:03 EDT 2025

Powered by FUDForum. Page generated in 0.07768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top