1.在项目上右键open module settings
2.Artifactas->+->jar->from modules with dependencies
3.设置一下内容,选中第一个extract to target jar,打完包后是一个jar包;选中copy to the output directory and link via manifest,打完包后是一个jar包,外带你项目所用的jar包,推荐第二个。
4.输出jar包目录,一定是项目根目录,并勾选Include in project build选项
5.设置完后,ok完成。
6.Build->Build Artifacts->x.jar->Build
7.到jar包输出目录去找jar包
8.测试jar包,cmd 到jar目录,执行
java -jar eastcom.jar
idea打包java可执行jar包 - 曲高终和寡 - 博客园