Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / December 2005

Tip: Looking for answers? Try searching our database.

compression on different platforms

Thread view: 
ctippur@gmail.com - 01 Dec 2005 20:56 GMT
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
Mike Amling - 01 Dec 2005 22:10 GMT
> All,
>
[quoted text clipped - 9 lines]
> 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.

> I want to achieve the following things:
> a) I want to compress a folder recursively.
[quoted text clipped - 10 lines]
>
> On Solaris however, I was able to unzip it.

  Solaris's unzip command uses the PKZIP algorithm.

> Solaris8 $ unzip XXXX.zip
> Archive:  XXXX.zip
[quoted text clipped - 10 lines]
>
> I appreciate any inputs on this issue.

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

     jar -t <XXXX.zip

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

     jar -x <XXXX.zip

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

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

--Mike Amling
ctippur@gmail.com - 02 Dec 2005 04:56 GMT
Thanks for the reply.
This certainly works with jar utility.
Is jar available on hpux and AIX with standard distribution?

- Shekar
ctippur@gmail.com - 02 Dec 2005 11:02 GMT
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
glen herrmannsfeldt - 04 Dec 2005 01:23 GMT
(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.

-- glen
Mike Amling - 04 Dec 2005 20:59 GMT
> (snip)
>
[quoted text clipped - 6 lines]
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.