What is use of MANIFEST.MF in WAR/JAR/EAR?

邮差的信 提交于 2019-12-03 09:54:01
gexicide

manifest.mf carries attributes of the artifact. One of the most well known ones is for example the main class of the jar that is used to start the jar file when no other class is specified. Syntax:

Main-Class: classname

Other purposes are, for example, package sealing and package versioning. Check out the java tutorial about it: http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html

A manifest in a jar usually contains much less information than for example AndroidManifest.xml. It is quite lightweight and does not contain any build or packaging information.

This is because java has no good module system. So, a jar is not a module which might need a lot of configuration information (like a list of modules to which it has dependencies). Instead, a jar is just a bunch of classes with some configuration information. Hopefully, this will be fixed by project jigsaw (http://openjdk.java.net/projects/jigsaw/).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!