1

Problem:

In short, I can run my uber jar (generated by the maven shade plugin) OUTSIDE of eclipse, by using java -jar myJar.jar (the main class is specified in the maven jar plugin), BUT I can't run the Main class inside the eclipse.

when running in eclipse, it runs from the target\classes folder, and I check all the dependencies are correctly listed in the classpath.

I also checked java -version, both eclipse and cmd got the same version

I wander what difference would it be?

user5324782
  • 177
  • 1
  • 1
  • 14
  • 1
    What happens when you try to run it in Eclipse? What errors do you see? – azurefrog Sep 23 '15 at 16:55
  • Some class not found exception for jars I clearly specified in the Pom – user5324782 Sep 23 '15 at 18:14
  • Update: for some reason the com.sun.xml.stream.buffer is in the uber jar but not in my Pom dependency tree. Thus when running in eclipse its throwing class not found. I always thought by specifying jaws-api and jaws-rt you can pull the sub dependencies ? – user5324782 Sep 23 '15 at 18:29

1 Answers1

2

add -vm C:program\javaxxxx\jre\bin\javaw.exe fix this

not java version for me has to be 1.7+

the eclipse.ini

its mainly because java.home is used in one of the pom. eclipse failed to pass the java home then such pom fails to pass the transitive dependencies therefore libraries will go missing

Take look of this.

Maven not picking JAVA_HOME correctly

Community
  • 1
  • 1
Junchen Liu
  • 5,435
  • 10
  • 51
  • 62