java running jar package error: there is no main list attribute, the error is still reported after configuring the main class, and finally resolved.

Today, when I was typing the jar package, I stepped on the pit at runtime:

There is no problem with packaging and running in idea, but an error is reported when running java -jar:
insert image description here
Most of the methods found on the Internet are to specify the main class.
insert image description here
I have already specified it but still report an error. There is still a way to say not to specify the mainClass, or useless.

In fact, it should be added again and
insert image description here
packaged again:
insert image description here
it was found that the version of maven was not specified,
insert image description here
and it succeeded after adding:insert image description here

Guess you like

Origin blog.csdn.net/wang121213145/article/details/130133549