错误:执行.jar文件时找不到或加载主类

问题描述 投票:0回答:1

我已经使用Intellij创建了一个Dropwizard应用程序。(此处com.indore.GalaxyApp是我的MainClass)的名称>

使用mvn clean package构建项目后,在我的target目录中创建了jar文件。

enter image description here

enter image description here

现在,我正在尝试通过终端使用jar文件运行应用程序,我得到以下响应:

enter image description here

enter image description hereMANIFEST.MF

enter image description here

为了使jar可执行]

  1. 我已经配置了Maven存档器,并在pom.xml acc中添加了以下插件到此SO answer

    enter image description here

  2. 我什至通过以下方式运行该应用程序:

    java -cp target / galaxy-1.0-SNAPSHOT.jar com.indore.GalaxyApp

  3. 但仍然出现相同的错误。

    我已经提到了这些帖子:

[setup-main-class-in-manifestCant execute jar file

有人可以告诉我解决此问题的方法吗?

我已经使用Intellij创建了一个Dropwizard应用程序。 (这里com.indore.GalaxyApp是我的MainClass的名称)使用mvn clean package构建项目后,在我的目标目录中有一个jar文件是...

java maven jar dropwizard
1个回答
0
投票

您正在尝试从命令行运行dropwizard应用程序。

请按照以下步骤创建一个胖子罐并从命令行运行它:

© www.soinside.com 2019 - 2024. All rights reserved.