美文网首页
jdk9 往manifest文件中添加信息

jdk9 往manifest文件中添加信息

作者: KeDaiBiaO1 | 来源:发表于2017-12-29 15:23 被阅读0次
需要解决的问题: 添加主程序入口

需要在MANIFEST.MF 中增加上面一行,即可直接运行
com.pollyduan.modular.Demo

jar 命令添加主程序入口到manifest文件 | 归档

jar [OPTION...] [ [--release VERSION] [-C dir] files] ...
使用 jar 命令java9的create开关,为module指定主类:
jar --create --file 路径/**.jar --main-class 主程序入口 -C 被打包的文件路径
-c or --create
Creates the archive.
-f=FILE or --file=FILE
Specifies the archive file name.
-e=CLASSNAME or --main-class=CLASSNAME
Specifies the application entry point for standalone applications bundled into a modular or executable modular JAR file.
-C DIR
Changes the specified directory and includes the files specified at the end of the command line. jar [OPTION...] [ [--release VERSION] [-C dir] files]

java 命令操作可执行jar文件

jar命令给manifest文件添加 MainClass的话,就可以在使用java命令的时候只指定module-path和-m模块名
java -p jar文件位置 -m 模块名

相关文章

网友评论

      本文标题:jdk9 往manifest文件中添加信息

      本文链接:https://www.haomeiwen.com/subject/wfyigxtx.html