Can't execute jar- file: “no main manifest attribute”

后端 未结 30 1937
不知归路
不知归路 2020-11-21 22:30

I have installed an application, when I try to run it (it\'s an executable jar) nothing happens. When I run it from the commandline with:

java -jar \

30条回答
  •  花落未央
    2020-11-21 22:58

    I got same error just now. If u're using gradle, just add next one in ur gradle.build:

    apply plugin: 'java'
    
    jar {
        manifest {
            attributes 'Main-Class': 'com.company.project.MainClass'
        }
    }
    

    Where com.company.project.MainClass path to ur class with public static void main(String[] args) method.

提交回复
热议问题