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 / General / June 2005

Tip: Looking for answers? Try searching our database.

Isn't a jar file just a zip file?

Thread view: 
Ramon F Herrera - 27 Jun 2005 05:18 GMT
It is my understanding that a *.jar file is simply a *.zip file
with a different extension and some META-INF/MANIFEST.MF file
inside.

I tried to: unzip a jar file and zip it again (both in Windows
and Unix) and I got a correupted file message when I double clicked
on it.

What did I do wrong?

-Ramon
Andrew Thompson - 27 Jun 2005 06:32 GMT
> It is my understanding that a *.jar file is simply a *.zip file
> with a different extension and some META-INF/MANIFEST.MF file
> inside.

A jar file does not even need a META-INF on occasions..
(You can load an applet or application directly out of a
.jar with no manifest, and I think WebStart can also
specify the main/applet class in the JNLP file.)

> I tried to: unzip a jar file and zip it again (both in Windows
> and Unix)

Using what?  The jar tool that comes with the SDK?
(If so, what exact commands are you typing?)

There are tools that write zip files that are not compatible
with Java's understanding of a zip file format.  One notable
one is WinZip when using maximum compression (though recently
I had reason to think that the core Java 1.5 had tightened it
even further, and even zips created with WinZip standard
compression were being rejected).

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Chris Uppal - 27 Jun 2005 08:00 GMT
> It is my understanding that a *.jar file is simply a *.zip file
> with a different extension and some META-INF/MANIFEST.MF file
> inside.

The manifest sub-"file" is required to be physically first in the JAR, which is
a requirement that ZIP tools will probably not understand.

   -- chris
Kevin McMurtrie - 27 Jun 2005 08:56 GMT
> It is my understanding that a *.jar file is simply a *.zip file
> with a different extension and some META-INF/MANIFEST.MF file
[quoted text clipped - 7 lines]
>
> -Ramon

It probably is corrupted or there's a buggy utility involved.  Jar files
really are ZIP files.  The only difference is that JAR files have rules
for file organization.
Ramon F Herrera - 27 Jun 2005 10:05 GMT
After my experience, I decided to limit my use of the OS-provided zip
utilities only to expand files (never to compress them), and I create
them with 'jar'.  I became convinced that I should not create jar files
with zip.

> It probably is corrupted or there's a buggy utility involved.

Those so-called buggy utilities are:

 - the "Send to Compressed (zipped) Folder" provided
   by Microsoft in Windows XP.
 - the "zip" utility that comes with RedHat Linux.

The above was tested in several different machines, with different
files.

-Ramon
Ramon F Herrera - 27 Jun 2005 10:18 GMT
I found out what I was was doing wrong (in Windows, anyway):

I had an extra folder inside another.  Instead of selecting the top
level folder and right-click the "Send To Compressed (zipped) Folder" I
should select all of its contents.

Still not sure what the problem is on Linux, though.

Well, it's a moot point, it's safer to use 'jar'.

Thanks to all who answered.

-Ramon
Andrea Desole - 27 Jun 2005 10:20 GMT
>   - the "zip" utility that comes with RedHat Linux.

I don't know what version you have, but the zip on my Mandrake is
working. I switched between zip and jar without problems. I didn't try
it on Windows


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.