maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TenLeftFingers <jarlathre...@gmail.com>
Subject Re: Build is successful but can't run?
Date Thu, 06 Feb 2014 10:03:16 GMT
"You should specify the fully qualified main class eg:
com.mycompany.app.App
in the mainClass field/parameter to the plugin."
"1. the main-class-name was supposed to be your main class"
Let me clarify. The entry appears in the manifest as:
mainClass: fully.qualified.path.to.MyApp
instead of
Main-Class: fully.qualified.path.to.MyApp

I've changed it in the pom (I thought that the tag was a fixed keyword so I
didn't change it there initially).

"The classpathPrefix line sets where to look for additional JAR files. It
is relative to where you are."
So relative to where I execute my java -jar ... command from. Okay, I have
that. I'm executing from the directory above (..) the target.

"Maven compiles and packages your program into a JAR. It copies all of
the supporting JAR files listed in your dependencies into target/lib.
Before you run, make sure that target/lib exists and has all of the JAR
files you need."
Yep, they're all there. Including the jar which contains the class it says
it can't load and I can see that that class is present in the jar.

"The exec plugin (http://mojo.codehaus.org/exec-maven-plugin/) as Wayne
has mentioned is another way to accomplish this. This will help you run
from within an IDE or by using mvn exec:exec, but it won't help you
package and ship your code out for other users."
Once I get this running from the command line, this will be an option that
I want to use. I'm still getting ClassNotFoundException though. I'm
guessing that since I _can_ see the dependencies that this line must be the
culprit:
"<classpathPrefix>target/</classpathPrefix>"
I'm going to try target/lib now.

This is a sample client so packaging isn't too important at this point.
Good to know, thank you.


On Wed, Feb 5, 2014 at 10:17 PM, Wayne Fay [via Maven] <
ml-node+s40175n5783328h45@n5.nabble.com> wrote:

> > *Failed to load Main-Class manifest attribute from target/myApp.jar*
> >
> > I opened the manifest and the *Main-Class* attribute was entered as
> > *mainClass.* So I changed it to the former and that got rid of that
> error.
> > But now  I *still *get the original error.
>
> You should specify the fully qualified main class eg:
> com.mycompany.app.App
> in the mainClass field/parameter to the plugin.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5783328&i=0>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5783328&i=1>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://maven.40175.n5.nabble.com/Build-is-successful-but-can-t-run-tp5783294p5783328.html
>  To unsubscribe from Build is successful but can't run?, click here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5783294&code=amFybGF0aHJlaWR5QGdtYWlsLmNvbXw1NzgzMjk0fDEyMDg3OTQ0MDQ=>
> .
> NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://maven.40175.n5.nabble.com/Build-is-successful-but-can-t-run-tp5783294p5783366.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message