java - intelliJ idea如何打包swing程序成jar?
PHPz
PHPz 2017-04-17 17:31:02
0
2
758

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

PHPz
PHPz

学习是最好的投资!

reply all(2)
黄舟

The reason for this should be that Main-Class is not specified in the manifest. Either write a bat script and call the jar command to specify it, or use jar to specify it when building gradle

迷茫
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": "..."
    }
  
}

Use jar task packaging in gradle

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!