Björn Wagner
Björn Wagner

Reputation: 77

Java library to create cabinet files on Unix?

Is there a Java library to create cabinet files on Unix. I don't need any compression support. I just want to create a plain cab file using Java.

Something similar to cablib (http://sourceforge.net/projects/cablib/) which can only be used for reading cab files would be perfect.

If there is really no library can I use a feasible work around? E.g. create a ZIP file and somehow convert it into a CAB file?

Upvotes: 2

Views: 948

Answers (2)

cobberboy
cobberboy

Reputation: 6225

Edit: The answer below isn't a pure java solution. Ant's CAB task documentation says it relies on a 3rd-party tool: Either MS's "CABARC" or the open-source "libcabinet", which seems to no longer exist. So there is no benefit to this approach compared to a 3rd-party system call.

Previous Answer (read above first):

If you need a pure java way of creating cab files (not extracting them), you can use ant's built-in "cab" task.

This gives you a few options:

  1. Call the ant task from within your java code by using ant's Launcher class;
  2. Find the source code for the task definition (here) , and remove references to the ant context to create your own Cab extract utility
  3. Run ant via a system call.

Upvotes: 0

Stephen C
Stephen C

Reputation: 719239

If there is really no library can I use a feasible work around?

Comments have suggested using the Linux Icab tool.

E.g. create a ZIP file and somehow convert it into a CAB file?

The ZIP file format is different in too many respects for there to be a simple transformation to turn a ZIP file into a CAB file.

Upvotes: 1

Related Questions