maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TenLeftFingers <jarlathre...@gmail.com>
Subject Re: Sonatype tutorial has an error? I can't execute the basic jar.
Date Tue, 13 Aug 2013 10:29:41 GMT
Thanks Anders, there's obviously a problem with the way I built it.


On Tue, Aug 13, 2013 at 11:08 AM, Anders Hammar [via Maven] <
ml-node+s40175n5767545h72@n5.nabble.com> wrote:

> Check the content of the jar file. Is there a file called (including path)
> /org/sonatype/mavenbook/App.class? Java says there isn't.
>
> /Anders
>
>
> On Tue, Aug 13, 2013 at 12:01 PM, TenLeftFingers <[hidden email]<http://user/SendEmail.jtp?type=node&node=5767545&i=0>>wrote:
>
>
> > From the sonatype introduction to Maven
> > (
> >
> http://books.sonatype.com/mvnex-book/reference/simple-project-sect-create-simple.html
> > ),
> > I've built a project following the instructions exactly. When I issue
> the
> > command:
> >
> >    java -cp target/simple-1.0-SNAPSHOT.jar org.sonatype.mavenbook.App
> >
> > I get the error:
> >
> >    Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/sonatype/mavenbook/App
> >    Caused by: java.lang.ClassNotFoundException:
> org.sonatype.mavenbook.App
> >         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> >         at java.security.AccessController.doPrivileged(Native Method)
> >         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> >         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> >     Could not find the main class: org.sonatype.mavenbook.App.  Program
> > will
> > exit.
> >
> > The project was created successfully:
> >    mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple \
> >    -DartifactId=simple \
> >    -Dpackage=org.sonatype.mavenbook \
> >    -Dversion=1.0-SNAPSHOT
> >
> > and built:
> >   $cd simple
> >   $mvn install
> >
> > What can be wrong with my java command that causes this exception?
> > (the .java file is present as is the .jar) so what can be the problem
> with
> > the java command?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://maven.40175.n5.nabble.com/Sonatype-tutorial-has-an-error-I-can-t-execute-the-basic-jar-tp5767544.html
> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767545&i=1>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767545&i=2>
> >
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://maven.40175.n5.nabble.com/Sonatype-tutorial-has-an-error-I-can-t-execute-the-basic-jar-tp5767544p5767545.html
>  To unsubscribe from Sonatype tutorial has an error? I can't execute the
> basic jar., click here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5767544&code=amFybGF0aHJlaWR5QGdtYWlsLmNvbXw1NzY3NTQ0fDEyMDg3OTQ0MDQ=>
> .
> 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/Sonatype-tutorial-has-an-error-I-can-t-execute-the-basic-jar-tp5767544p5767548.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message