I noticed that JAR,warandearfileshaveamanifest.mffileunderthemeta-INF folder。
whatistheuseofthemanifest.MF file? watallthingscanbespecifiedinthisfile?
thecontentofthemanifestfileinajarfilecreatedwithversion 1.0 ofthejavadevelopmentkitisthefollowing。
alltheentriesareasname-value pairs.thenameofaheaderisseparatedfromitsvaluebyacolon.thedefaultmanifestshowsthatitconformstton
themanifestcanalsocontaininformationabouttheotherfilesthatarepackagedinthearchive.exactlywhatfileinformationisrecordedintheme eduseforthejarfile.thedefaultmanifestfilemakesnoassumptionsaboutwhatinformationitshouldrecordaboutout er files,soitssingleler
特殊采购管理头
dependingontheintendedroleofthejarfile,thedefaultmanifestmayhavetobemodified.ifthejarfileiscreatedonlyforthepurposeofarcharchied
mostusesofjarfilesgobeyondsimplearchivingandcompressionandrequirespecialinformationtobeinthemanifestfile.summmarizedbelowarebarebarebebebestfestfile ersthatarerequiredforsomespecial-purpose jar -文件功能
applicationsbundledasjarfiles 3360 ifanapplicationisbundledinajarfile, thejavavirtualmachineneedstobetoldwhattheentrypointtotheapplicationis.anentrypointisanyclasswithapublicstaticvoidmain (g令人担心ionisprovidedinthemain-class header,which has the general form:
Main-Class: classname
thevalueclassnameistobereplacedwiththeapplication ' sentry point。
download extensions 3360 downloadextensionsarejarfilesthatarereferencedbythemanifestfilesofotherjarfiles.inatypicalsituation, anappletwillbebundledinajarfilewhosemanifestreferencesajarfile (orseveraljarfiles ) )。 thatwillserveasanextensionforthepurposesofthatapplet.extensionsmayreferenceeachotherinthesameway。
downloadextensionsarespecifiedintheclass-pathheaderfieldinthemanifestfileofanapplet,application,oranotherextension.AC ll
class-path : servlet.jarinfobus.jar acme/beans.jar
With this header,theclassesinthefilesservlet.jar,infobus.jar,and acme/beans.jarwillserveasextensionsforpurposesofthofthther
package sealing : apackagewithinajarfilecanbeoptionallysealed, whichmeansthatallclassesdefinedinthatpackagemustbearchivedinthesamejarfile.apackagemightbesealedtoensureversionsistencyam
To seal a package,anameheaderneedstobeaddedforthepackage,followed by a Sealed header,similar to this:
name : my公司/my package /
sealed :真
the name header ' svalueisthepackage ' srelativepathname.notethatitendswitha '/' todistinguishitfromafilename.anyheadersfofore withoutanyinterveningblanklines,applytothefileorpackagespecifiedinthenameheader.intheaboveeexample, becausethesealedheaderoccursafterthename : my company/my package header,with no blank lines between,thesealedheaderwillbeintenter
包版本3360 thepackageversioningspecificationdefinesseveralmanifestheaderstoholdversioninginformation.onesetofsuch heversioningheadersshouldappeardirectlybeneaththenameheaderforthepackage.thisexampleshowsallthe
Name: java/util/
specification-title 3360 ' javautilityclasses '
规范版本: ' 1.2 '
规范-供应商: ' sun Microsystems,Inc.'。
implementation-title 3360 ' Java.util '
implementation-version : ' build 57 '
implementation-vendor : ' sun Microsystems,Inc.'