 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ctippur@gmail.com Guest
|
Posted: Thu Dec 01, 2005 8:56 pm Post subject: 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 XXXX.zip
Archive: XXXX.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 XXXX.zip
drwxr-xr-x 2 itv1 itv1 618 Dec 1 16:23 bin
I appreciate any inputs on this issue.
Thanks
- Shekar
|
|
| Back to top |
|
 |
Mike Amling Guest
|
Posted: Thu Dec 01, 2005 10:10 pm Post subject: Re: compression on different platforms |
|
|
[email]ctippur (AT) gmail (DOT) com[/email] wrote:
| Quote: | 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.
|
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.
| Quote: | 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.
|
Solaris's unzip command uses the PKZIP algorithm.
| Quote: | Solaris8 $ unzip XXXX.zip
Archive: XXXX.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 XXXX.zip
drwxr-xr-x 2 itv1 itv1 618 Dec 1 16:23 bin
I appreciate any inputs on this issue.
|
Does your HPUX system have the Java SDK installed? If so, try
jar -t
to see a list of files in the .zip archive, and try
jar -x
to uncompress them. Note: If a Java JRE is installed but not the SDK, try
java sun.tools.jar.Main -t
or
java sun.tools.jar.Main -x
--Mike Amling
|
|
| Back to top |
|
 |
ctippur@gmail.com Guest
|
Posted: Fri Dec 02, 2005 4:56 am Post subject: Re: 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
|
|
| Back to top |
|
 |
ctippur@gmail.com Guest
|
Posted: Fri Dec 02, 2005 11:02 am Post subject: Re: 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
|
|
| Back to top |
|
 |
glen herrmannsfeldt Guest
|
Posted: Sun Dec 04, 2005 1:23 am Post subject: Re: compression on different platforms |
|
|
Mike Amling wrote:
(snip)
| Quote: | 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.
|
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
|
|
| Back to top |
|
 |
Mike Amling Guest
|
Posted: Sun Dec 04, 2005 8:59 pm Post subject: Re: compression on different platforms |
|
|
glen herrmannsfeldt wrote:
| Quote: | Mike Amling wrote:
(snip)
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.
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.
|
Yes, that is true. Rather than "not compatible with", I should have
said "not fully compatible with" or "not the same as".
--Mike Amling
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|