We help IT Professionals succeed at work.

Jar command for extract and combine file  in Java

duncanb7 asked
Dear Expert,
Question-1 I have some jar extract and combin files question and use the help from  this link at http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jar.html#argfiles. But I extract
 files , for example, the jar file at the  link at http://mirrors.ibiblio.org/pub/mirrors/maven2/milyn/j2ee/1.4/j2ee-1.4.jar    by command
jar xf j2ee-1.4jar  that will create one directory called javax. And then I do the reverse by the command
jar cvf  junk.jar javax, junk.jar is created but its size is 789k which is totaly different from orginal one of 1668k
from j2ee-1.4.jar. Because I could NOT  attach my jar file into exchange-expert link, so I made this j2ee-1.4.jar as my similar problem. COuld you tell me why whether I use wrong option on jar command
Suppose both file size of junk.jar and j2ee-1.4.jar is same  
Question-2: I don't understand actully meaning of manifest . What is its pupose for Jar proccess, Just
from websearch  explain this with "  Manifest is an XML based, database driven Content Management System (CMS) for satisfying corporate communications needs, including Internet and Intranet"
Question-3, please possilbe, please download the file to test it at your side

Please advise it kindly

Watch Question


I mean extract example.jar file and combine the jar file example  directory to create example-test.jar.
Both example.jar and example-test.jar should be exactly same in format and file size, Right ?

Please advise it , if possible,please try the j2ee-1,4.jar  to do extract jar file and combin jar file directory

option t can give you the list of what is in the jar file ...
you should see the difference

the size may come of the option to compress or not ...

the manifest file is here to set up things : if the jar contains several java classes, how to know the one with the main() function for example ? this file answers this question

hope this helps