简体   繁体   English

用eclipse导出并在cmd中运行

[英]export with eclipse and run in cmd

I'm trying to export a maven application with eclipse and then run it from the cmd. 我正在尝试使用Eclipse导出Maven应用程序,然后从cmd运行它。

I tried to export it as a excutable jar but when I try to run it, cmd says it can't find the main class 我试图将其导出为可执行的jar,但是当我尝试运行它时,cmd说它找不到主类

how can I solve this problem? 我怎么解决这个问题?

thanks 谢谢

did you specify the main class in the jar manifest ? 您是否在jar清单中指定了主类?

in maven you set it like this (if I'm not wrong) 在Maven中,您可以这样设置(如果我没记错的话)

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
      <archive>
        <manifest>
          <mainClass>mypackage.myMainClass</mainClass>
        </manifest>
      </archive>
    </configuration>
</plugin>

Hope this will help, 希望这会有所帮助,
Yann

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM