tags:

views:

244

answers:

4

Hi, does anyone know a library that makes it possible to create a cabinet file in pure Java?

+1  A: 

As far as I know, you can only create .cab files using the CABARC utility from Microsoft. So there is no "pure java" implementation.

You can call something like:

CABARC n myArchive.cab *.*

using Runtime.getRuntime().exec() to create myArchive.cab.

arturh
sry, thats not a solution to the problem, because it is not really platform independent.
You should probably update your question to indicate that you need a platform independent solution. Also, given that .cab is a proprietary Microsoft format, I'm not sure that you'd be able to find a solution that work outside of Windows.
Jack Leow
A: 

In Java you would normally create a JAR file using the utility called jar. If you use a build system such as ant or maven it has direct support for building JAR files.

Peter Lawrey
+1  A: 

To get started you can use Java's DeflaterOutputStream to do Deflate compression which is one of the supported cab compression schemes.

Oh whaddaya know... I found one: cablib (but it's not in development since 2006)

Karl the Pagan
jcablib, was also what i found, but the source forge site talks only about extracting files.
+1  A: 

Hi

I wrote a java application to do this (pure java implementation). It does not support compression and so it basically just packages the files together and adds the cabinet header to the system. It isn't too complicated to do, took me about a day to bash it out.

Not too sure how complex it would be to implement compression but I assume it would not be all that trivial. There is a fair bit of information available on the net on the structure of the cabinet file format.

Regards, Graham

grahamrb