Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > compression on different platforms
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 25th February 04:33
ctippur
External User
 
Posts: 1
Default compression on different platforms



All,

PS. Please pardon me if I am posting this in the wrong group.

I have used java.util.zip package to compress a folder recursively
(which contains sub folders) using the package java.util.zip. It
created a zip file after that. I am unable to unzip OR gunzip this file
on HPUX.
There are couple of problems on HPUX:
1. there is no unzip tool that comes with the OS distribution
2. gunzip tool that resides in /usr/contrib/bin folder is not
appropriate. When I rename the file to .gz file and run gunzip on it,
it comes with "file exists" error.
I want to achieve the following things:
a) I want to compress a folder recursively.
b) I want to be able to access the files within the compressed file via
java
c) the compressed file must be "uncompressable" via tools available
with OS. THe most convenient tool is compress as it is available
everywhere with regular OS distribution.

I have read on java docs that in order to achieve compress via gzip, we
can do that only to a file. We have to essentially tar the folder and
then gzip the tar ball. If we do it this way, can we access the files
within the tar ball via java?

On Solaris however, I was able to unzip it.
Solaris8 $ unzip ***X.zip
Archive: ***X.zip
inflating: bin/hpux-risc
inflating: bin/root.sh
inflating: bin/createpackage
inflating: bin/env
inflating: bin/postinstallcheck
inflating: bin/agentconnection.sh
Solaris8 $ ls -ltr
total 1168
-rw-r--r-- 1 itv1 itv1 585115 Dec 1 16:23 ***X.zip
drwxr-xr-x 2 itv1 itv1 618 Dec 1 16:23 bin

I appreciate any inputs on this issue.
Thanks
- Shekar
  Reply With Quote


  sponsored links


2 25th February 04:33
mike amling
External User
 
Posts: 1
Default compression on different platforms



gunzip uses the gzip algorithm. Java's jar command, and the
java.util.zip package, use the PKZIP algorithm, which is not compatible with gzip.

Solaris's unzip command uses the PKZIP algorithm.

Does your HPUX system have the Java SDK installed? If so, try

jar -t <***X.zip

to see a list of files in the .zip archive, and try

jar -x <***X.zip

to uncompress them. Note: If a Java JRE is installed but not the SDK, try

java sun.tools.jar.Main -t <***X.zip
or
java sun.tools.jar.Main -x <***X.zip

--Mike Amling
  Reply With Quote
3 25th February 04:33
ctippur
External User
 
Posts: 1
Default compression on different platforms


Thanks for the reply.
This certainly works with jar utility.
Is jar available on hpux and AIX with standard distribution?

- Shekar
  Reply With Quote
4 25th February 04:33
ctippur
External User
 
Posts: 1
Default compression on different platforms


Is there a java utility available which uses the compress algorithm?
compress is a tool available on all the platforms (as far as I can
tell).

- Shekar
  Reply With Quote
5 25th February 04:33
glen herrmannsfeldt
External User
 
Posts: 1
Default compression on different platforms


Traditionally gunzip could unzip single file zip files,
and, I believe, the first file of multiple file ones. I don't remember
why it could do this, though. I have used jar for zip files when I
didn't have unzip.

-- glen
  Reply With Quote
6 25th February 04:33
mike amling
External User
 
Posts: 1
Default compression on different platforms


Yes, that is true. Rather than "not compatible with", I should have
said "not fully compatible with" or "not the same as".

--Mike Amling
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666