0

In pom.xml , main class is mentioned in maven shade plugin and maven jar plugin to convert akka project into maven and make it an executable jar.enter image description here

But after running mvn clean install on that project and java -jar , I get this error: enter image description here

Kindly help me in main class path to be added for maven jar plugin

Roma Jain
  • 333
  • 4
  • 13
  • Is your main class actually inside the JAR? – lexicore Apr 11 '18 at 05:32
  • Can you elaborate @lexicore – Roma Jain Apr 11 '18 at 05:47
  • Yes it is inside the .jar file - it has akkaexample folder and akkamain.class – Roma Jain Apr 11 '18 at 05:49
  • Unzip your JAR file and check that there is `akkaexample/akkamain.class` file in there. – lexicore Apr 11 '18 at 05:49
  • Try adding `package` to the `maven-shade-plugin` configuration. – lexicore Apr 11 '18 at 05:51
  • @RomaJain Make sure your main class isn't extending any 3rd party classes. – Afgan Apr 11 '18 at 05:52
  • @RomaJain i think your problem is lies in your class name, Please specify fully qualified name in assembly plugin like com.stackexchange.stackoverflow.MainClass – Afgan Apr 11 '18 at 05:55
  • @Afghan is the picture visible to you? SO in that project explorer,akkaexample is the project name.Inside that,src/main/java is the hierarchy.Then akkaexample is the package inside , akkamain.java is supposed to be the main class – Roma Jain Apr 11 '18 at 06:02
  • @lexicore , i added then mvn package the project but still the same error – Roma Jain Apr 11 '18 at 06:04
  • My main class is extending third party classes, what should be done – Roma Jain Apr 11 '18 at 06:05
  • Try running with `java -jar -verbose:class ` and check the output. – lexicore Apr 11 '18 at 06:08
  • @Afgan It does not matter if main class extend 3rd party classes or not. – lexicore Apr 11 '18 at 06:08
  • I ran with verbose command, still the same error.Can you guide me with class path – Roma Jain Apr 11 '18 at 06:10
  • @RomaJain You should check the output. Is your class loaded? – lexicore Apr 11 '18 at 06:11
  • @RomaJain I think we can't help you without a [MCVE](http://stackoverflow.com/help/mcve). Make a minimal complete project which reproduces this error and share it via GitHub. I promise I will take a look. – lexicore Apr 11 '18 at 06:13
  • @RomaJain I have a few projects which build an executable fat-jar with `maven-shade-plugin`. I can't see much difference to your configuration. So this must be something we don't see at the moment. – lexicore Apr 11 '18 at 06:14
  • @RomaJain refer this link for main extending some other class [See it answer by Eric Leschinski](https://stackoverflow.com/questions/29366373/maven-error-could-not-find-or-load-main-class) – Afgan Apr 11 '18 at 06:17

0 Answers0