首页 > intelliJ idea如何打包swing程序成jar?

intelliJ idea如何打包swing程序成jar?

如题,项目是使用maven的一个swing程序,想要打包成jar运行。
自己的思路是新建一个artifacts,然后build这个artifacts即可。但是按照这种方式打包之后双击提示:


这个原因应该是没有在manifest中指定Main-Class吧,要不乖乖写个bat脚本调用jar命令指定,要不gradle构建时用jar指定


jar {
    from {
        configurations.compile.collect {
            it.isDirectory() ? it : zipTree(it)
        }
    }
    exclude 'META-INF/MANIFEST.MF'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/*.SF'
    exclude 'META-INF/*.DSA'
    exclude 'META-INF/*.RSA'

    manifest {
        attributes "Implementation-Title": "..."
        attributes "Implementation-Version": version
        attributes "Main-Class": "..."
    }
  
}

使用gradle中的jar任务打包

【热门文章】
【热门文章】