Maven Error: Could not find or load main class

后端 未结 12 1619
忘了有多久
忘了有多久 2020-12-05 07:09

I\'m using a Java Maven program and I don\'t know what to enter as the . I\'ve tried all kinds of things based off of numerous stackoverflow q

12条回答
  •  误落风尘
    2020-12-05 07:17

    For me the problem was nothing to do with Maven but to do with how I was running the .jar. I wrote some code and packaged it as a .jar with Maven. I ran it with

    java target/gs-maven-0.1.0.jar
    

    and got the error in the OP. Actually you need the -jar option:

    java -jar target/gs-maven-0.1.0.jar
    

提交回复
热议问题