You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

1

Monday, May 31st 2010, 4:47am

Jabaco and izPack

Hi,

I have got my small sample file maintenance program going including a Jasper report etc. Compiles fine to a jar file - and I have copied just the .jar file, H2 database and report definition files to another PC without Jabaco installed and it all works fine.

Thought I would try to set up an installer for the program and izPack (using PackJacket) seemed like a reasonable tool to use. It creates an installer OK, but when I run the installer I get the following error :-

ERROR duplicate entry: META-INF/LICENSE.txt

The Jabaco programs .jar file is only partially installed in the target directory. It looks to me like the Jabaco produced .jar has at leat one duplicated file in the META-INF. Is this a bug in Jabaco? Is there some way to fix it? Or is there another 'installer' package recommended for use with Jabaco?

Any help much appreciated.

Thanks

Roger L

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Monday, May 31st 2010, 8:36am

You can rename the *.jar file of Jabaco to *.zip and open it for inspection/repair.
Jar files are just zip archives.

I doubt that Jabaco garbles up the jar file.

Post your findings here.

Success!

A1880

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

3

Monday, May 31st 2010, 8:47am

Hi,

Did what you suggested - the MATA-INF directory in the Jabaco produced .jar file has 5 files called LICENSE.txt and 4 files called NOTICE.txt.

I wonder if they come from the other .jar files needed by the application ie the jar files included for Jasper Reports and also the H2 database driver?

Roger L

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

4

Monday, May 31st 2010, 8:53am

Further - I tried to delete all but one copy of the duplicated files - but they all went. The licence files were all headed Apache. Very strange behaviour!

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

5

Monday, May 31st 2010, 9:17am

I've never come across this.
There are no such files in the Jar files of my projects even if I include numerous external jar files in my classpath.

What do you mean by "they all went"?
Does it work OK after deleting the files?

Greetings

A1880

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

6

Monday, May 31st 2010, 9:30am

When I say they all went - I mean that I highlighted 4 of the 5 files and then clicked on delete - all 5 files disappeared from the directory listing.

I then renamed the zip back to a jar - double clicked - worked fine.

Then rebuilt the installer with the new .jar file - when I ran it I got a different error -

duplicate entry: org/apache/commons/collections/ArrayStack.class



Everything is working fine when I just run Jabaco - it is only when running the izPack installer that I am running into problems - I am on Vista - maybe problems with izPack under Vista? Are there any other Java installers I should try?



I'm going out soon (5:30pm here) - so I'll check back in later.



Thanks



Roger L

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

7

Tuesday, June 1st 2010, 12:09am

Went back to Basics! I removed all references to JasperReports in my project and tried again - no duplicated files in the Meta-INF - created the installer OK and it works 'as advertised'. So the problem appears to be an incompatability between izPack and Jasper Reports. Going forward it would appear that I have 3 options - find an alternative for izPack, find an alternative for Jasper Reports, or try to find a way to fix the .jar file produced by Jabaco so that izPack will work with it (ie by removing duplicates etc etc).

The first alternative does not look encouraging as all the java based installer packages other than izPack that I have found seem to be very old and no longer actively supported (if anyone knows of anything good please advise). In any case izPack seems to be a good utility.

The second alternative I have not followed up yet (any suggestions from anyone?).

The last alternative I will play around with today (its 8am in Australia right now).



Any comments/suggestions much appreciated.



Roger L

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

8

Tuesday, June 1st 2010, 3:16am

Problem resolved.

1/ JasperReports has LICENSE.txt and NOTICE.txt in the META-INF folder of many (but not all) of its .jar files. It also has some files duplicated between .jars (in particular some of the collections files appear in both the collections and beanutils .jar files that are needed to show a Jasper Report in a Jabaco project. (in org.apache.commons.collections)

2/ When Jabaco builds a .jar file for the project it includes the duplicated files. This does not affect the ability of the Jabaco produced jar to run OK.

3/ The izPack installer aborts the install operation when it encounters these duplicated files in the install.jar it has created from the Jabaco jar etc.

4/ I copied the JasperReports .jars that I needed into my Jabaco project folder and modified these jars (by converting to a .zip and then after the 'fix' renaming them back to .jar). The fix involved deleting all LICENSE.txt and NOTICE.txt files from the META-INF folder in each jar and then deleting the collections folder (org.apache.commons.collections) from the beanutils .jar as all those files were already in the collections.jar.

5/ Now when generating an izPack installer the install.jar runs fine and installs everything as expected. Uninstall jar is also produced and works as expected.



nb 1/ Jars needed to run JasperReports are just as detailed in the Forum Entry 'JasperReport and Jabaco from birosys - thanks for the starter!

2/ Strangely the Jabaco produced jar for my project is about 8Mb - after an izPack install the equivalent jar is nearly twice as big!

Roger L

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

9

Tuesday, June 1st 2010, 12:26pm

Resolved (sort of) the issue with files being twice the size (roughly) when installed from izPack compared to the original files (particularly the jar file from the Jabaco project). If I turn pack200 off in izPack then while the installer is much bigger (about 4X), the files installed on the target machine match the size of the originals. Obviously a problem with pack200 in izPack.

Roger L

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

10

Tuesday, June 1st 2010, 1:02pm

Jar files can be compressed or not.
It might help to re-jar your contributing libraries using the Java jar tool with compression enabled.

The idea to simply remove license and notice files appears ill-advised to me.
Why not just renaming them to achieve uniqueness?

Greetings

A1880

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

11

Tuesday, June 1st 2010, 11:47pm

That sounds sensible.

I'll also contact the Jasper people to suggest that they rename the files - I can't be the only person to use izPack with the Jasper Report Viewer etc.

As a newby to the java environment can you expand on the re-jar process - or point me somewhere I can read up on it.

Thanks

Roger L

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

12

Wednesday, June 2nd 2010, 8:38am

The standard Java Development Kid (JDK) of Sun includes a "jar" packaging tool.
By "re-jar" I mean to process of unpacking and packing with compression turned on.
Ask Google to find tutorials on using "jar". Calling jar without commandline parameters in a cmd.exe box gives you a quick overview.
You might know the Unix archiving tool "tar" which is a kind of role model for jar.

Happy experimenting

A1880

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

13

Wednesday, June 2nd 2010, 10:12am

Thanks, I'll do as you suggest!

Roger L

Roger L

Beginner

  • "Roger L" started this thread

Posts: 24

Date of registration: Apr 12th 2010

  • Send private message

14

Thursday, June 3rd 2010, 9:39am

Unpacked the jar files for JasperReports - then re-jar'd them with compression. The jar files were slightly larger. Then rebuilt my izPack installer with Pack200 compression. Same old problem - nice small 2Mb installer (8Mb without the Pack200) - but my executable jar installed was 15Mb compared to 8Mb in the original. If I make the installer without Pack200 compression I get an 8Mb installer still, but only an 8Mb executable jar installed.

In all cases my app worked fine.

As I'm not that unhappy with a larger install file I'll just not use the Pack200 compression in izPack - I'd rather have a smaller executable.

Also no response whatsoever from JasperReports on their duplicated filenames - so I'll just settle for renaming the files in their jars to avoid the problems with izPack.

Rate this thread
WoltLab Burning Board