You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lan <bl...@gmail.com> on 2007/02/07 11:18:07 UTC

executable jar

Hi, all

    I have generated an executable jar by using maven, (mvn package). The
jar includes the generated classes and main class.
    But it can only be used in my own machine. Shall I do some more settings
to the project? What can I do?

    Thanks advance!

Jane

Re: executable jar

Posted by franz see <fr...@gmail.com>.
Good day to you, Jane,

For a war ( assuming you delcared your <packaging> as "war" ), all your
dependencies ( except dependencies with the scope "provided" ) would be
copied to WEB-INF\lib automatically, before assembling the war.

So that's

<project>
  <groupId>...</groupId>
  <artifactId>...</artifactId>
  <version>...</version>
  <packaging>war</packaging>

  ...
</project>

See [1] for more info.

Cheers,
Franz

[1] http://maven.apache.org/ref/2.0.4/maven-model/maven.html


Lan-6 wrote:
> 
> Hi, Wayne,
> 
>      Thanks for your reply.
> 
>       How can I package all the necessary libraries into the output
> jar?For
> a war, the lib will under the web-inf. In a maven project, the dependent
> jars are all in my own repositories, aren't they? When I perform "mvn
> package", it hasn't included them.
>       If another computer has the java environment, shall I run the
> executable jar with the same repository? I can't imagin it.
> 
>      I am confusing it.Thanks again.
> Jane
> 
> 2007/2/8, Wayne Fay <wa...@gmail.com>:
>>
>> NoClassDefFoundError usually means that you haven't packaged all the
>> necessary libraries etc up into your output jar, or perhaps their JVM
>> does not have the proper libraries available which you have installed
>> in your machine.
>>
>> Check your CLASSPATH environment variable on your machine, and the
>> jars you've manually installed into your JVM/JRE vs the CLASSPATH and
>> jars available on the other computer(s).
>>
>> Wayne
>>
>> On 2/7/07, Lan <bl...@gmail.com> wrote:
>> > Hi,Franz,
>> >
>> >    Thanks for your quick reply.
>> >
>> >    The error shows:
>> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> > javax/media/NoPlayerException
>> >
>> > Actually, I have difined the MainClass in POM. But in my own machine,
>> it
>> > runs correctly.
>> >
>> > Jane
>> >
>> > 2007/2/7, franz see <fr...@gmail.com>:
>> > >
>> > >
>> > > Good day to you, Jane,
>> > >
>> > > What do you mean by it can only be used in your machine? What error
>> are
>> > > you
>> > > getting when used in another machine?
>> > >
>> > > Cheers,
>> > > Franz
>> > >
>> > >
>> > > Lan-6 wrote:
>> > > >
>> > > > Hi, all
>> > > >
>> > > >     I have generated an executable jar by using maven, (mvn
>> package).
>> > > The
>> > > > jar includes the generated classes and main class.
>> > > >     But it can only be used in my own machine. Shall I do some more
>> > > > settings
>> > > > to the project? What can I do?
>> > > >
>> > > >     Thanks advance!
>> > > >
>> > > > Jane
>> > > >
>> > > >
>> > >
>> > > --
>> > > View this message in context:
>> > > http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
>> > > Sent from the Maven - Users mailing list archive at Nabble.com.
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > > For additional commands, e-mail: users-help@maven.apache.org
>> > >
>> > >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/executable-jar-tf3186039s177.html#a8867084
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: executable jar

Posted by Lan <bl...@gmail.com>.
Hi, Wayne,

     Thanks for your reply.

      How can I package all the necessary libraries into the output jar?For
a war, the lib will under the web-inf. In a maven project, the dependent
jars are all in my own repositories, aren't they? When I perform "mvn
package", it hasn't included them.
      If another computer has the java environment, shall I run the
executable jar with the same repository? I can't imagin it.

     I am confusing it.Thanks again.
Jane

2007/2/8, Wayne Fay <wa...@gmail.com>:
>
> NoClassDefFoundError usually means that you haven't packaged all the
> necessary libraries etc up into your output jar, or perhaps their JVM
> does not have the proper libraries available which you have installed
> in your machine.
>
> Check your CLASSPATH environment variable on your machine, and the
> jars you've manually installed into your JVM/JRE vs the CLASSPATH and
> jars available on the other computer(s).
>
> Wayne
>
> On 2/7/07, Lan <bl...@gmail.com> wrote:
> > Hi,Franz,
> >
> >    Thanks for your quick reply.
> >
> >    The error shows:
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > javax/media/NoPlayerException
> >
> > Actually, I have difined the MainClass in POM. But in my own machine, it
> > runs correctly.
> >
> > Jane
> >
> > 2007/2/7, franz see <fr...@gmail.com>:
> > >
> > >
> > > Good day to you, Jane,
> > >
> > > What do you mean by it can only be used in your machine? What error
> are
> > > you
> > > getting when used in another machine?
> > >
> > > Cheers,
> > > Franz
> > >
> > >
> > > Lan-6 wrote:
> > > >
> > > > Hi, all
> > > >
> > > >     I have generated an executable jar by using maven, (mvn
> package).
> > > The
> > > > jar includes the generated classes and main class.
> > > >     But it can only be used in my own machine. Shall I do some more
> > > > settings
> > > > to the project? What can I do?
> > > >
> > > >     Thanks advance!
> > > >
> > > > Jane
> > > >
> > > >
> > >
> > > --
> > > View this message in context:
> > > http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
> > > Sent from the Maven - Users mailing list archive at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: executable jar

Posted by Wayne Fay <wa...@gmail.com>.
NoClassDefFoundError usually means that you haven't packaged all the
necessary libraries etc up into your output jar, or perhaps their JVM
does not have the proper libraries available which you have installed
in your machine.

Check your CLASSPATH environment variable on your machine, and the
jars you've manually installed into your JVM/JRE vs the CLASSPATH and
jars available on the other computer(s).

Wayne

On 2/7/07, Lan <bl...@gmail.com> wrote:
> Hi,Franz,
>
>    Thanks for your quick reply.
>
>    The error shows:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/media/NoPlayerException
>
> Actually, I have difined the MainClass in POM. But in my own machine, it
> runs correctly.
>
> Jane
>
> 2007/2/7, franz see <fr...@gmail.com>:
> >
> >
> > Good day to you, Jane,
> >
> > What do you mean by it can only be used in your machine? What error are
> > you
> > getting when used in another machine?
> >
> > Cheers,
> > Franz
> >
> >
> > Lan-6 wrote:
> > >
> > > Hi, all
> > >
> > >     I have generated an executable jar by using maven, (mvn package).
> > The
> > > jar includes the generated classes and main class.
> > >     But it can only be used in my own machine. Shall I do some more
> > > settings
> > > to the project? What can I do?
> > >
> > >     Thanks advance!
> > >
> > > Jane
> > >
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
> > Sent from the Maven - Users mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: executable jar

Posted by franz see <fr...@gmail.com>.
Good day to you, Jane,

Maybe you only had the jmf installed in your machine and not declared as a
dependency ( you can check your dependencies by doing mvn
project-info-reports:dependencies and opening
target\site\dependencies.html...either that or the easier to remember mvn
site then open target\site\index.html and navigate to the dependencies page
:) ).

If so, you may want to declare that as a dependency. 

Cheers,
Franz


Jane-24 wrote:
> 
> Hi, markku,
>     Thanks for your reply.
> 
>    Maybe the reason is like 1 just you said.
>    The project I aims to package has a dependeny for jmf.jar. But it
> hasn't
> included in the jar. How can I include it?
> 
> Jane
> 
> 
> 2007/2/8, Markku Saarela <ma...@iki.fi>:
>>
>> Hi,
>>
>> There are at least two way to get this exception.
>>
>> 1. at other machines you dont have JMF api available for executable jar.
>> 2. Somehow at other machine you MediaLocator constructor get wrong
>> parameter.
>>
>> - markku
>>
>> Lan wrote:
>> > Hi,Franz,
>> >
>> >    Thanks for your quick reply.
>> >
>> >    The error shows:
>> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> > javax/media/NoPlayerException
>> >
>> > Actually, I have difined the MainClass in POM. But in my own machine,
>> it
>> > runs correctly.
>> >
>> > Jane
>> >
>> > 2007/2/7, franz see <fr...@gmail.com>:
>> >>
>> >>
>> >> Good day to you, Jane,
>> >>
>> >> What do you mean by it can only be used in your machine? What error
>> are
>> >> you
>> >> getting when used in another machine?
>> >>
>> >> Cheers,
>> >> Franz
>> >>
>> >>
>> >> Lan-6 wrote:
>> >> >
>> >> > Hi, all
>> >> >
>> >> >     I have generated an executable jar by using maven, (mvn
>> package).
>> >> The
>> >> > jar includes the generated classes and main class.
>> >> >     But it can only be used in my own machine. Shall I do some more
>> >> > settings
>> >> > to the project? What can I do?
>> >> >
>> >> >     Thanks advance!
>> >> >
>> >> > Jane
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
>> >> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/executable-jar-tf3186039s177.html#a8866934
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: executable jar

Posted by Markku Saarela <ma...@iki.fi>.
Include <addClasspath>true</addClasspath> element to manifest 
configuration if not allready done.

Package deliverable zip file  witch have all these classpath dependency 
jars with assembly plugin.

- markku

Jane wrote:
> Hi, markku,
>    Thanks for your reply.
>
>   Maybe the reason is like 1 just you said.
>   The project I aims to package has a dependeny for jmf.jar. But it 
> hasn't
> included in the jar. How can I include it?
>
> Jane
>
>
> 2007/2/8, Markku Saarela <ma...@iki.fi>:
>>
>> Hi,
>>
>> There are at least two way to get this exception.
>>
>> 1. at other machines you dont have JMF api available for executable jar.
>> 2. Somehow at other machine you MediaLocator constructor get wrong
>> parameter.
>>
>> - markku
>>
>> Lan wrote:
>> > Hi,Franz,
>> >
>> >    Thanks for your quick reply.
>> >
>> >    The error shows:
>> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> > javax/media/NoPlayerException
>> >
>> > Actually, I have difined the MainClass in POM. But in my own 
>> machine, it
>> > runs correctly.
>> >
>> > Jane
>> >
>> > 2007/2/7, franz see <fr...@gmail.com>:
>> >>
>> >>
>> >> Good day to you, Jane,
>> >>
>> >> What do you mean by it can only be used in your machine? What 
>> error are
>> >> you
>> >> getting when used in another machine?
>> >>
>> >> Cheers,
>> >> Franz
>> >>
>> >>
>> >> Lan-6 wrote:
>> >> >
>> >> > Hi, all
>> >> >
>> >> >     I have generated an executable jar by using maven, (mvn 
>> package).
>> >> The
>> >> > jar includes the generated classes and main class.
>> >> >     But it can only be used in my own machine. Shall I do some more
>> >> > settings
>> >> > to the project? What can I do?
>> >> >
>> >> >     Thanks advance!
>> >> >
>> >> > Jane
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
>> >> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: executable jar

Posted by Jane <ja...@gmail.com>.
Hi, markku,
    Thanks for your reply.

   Maybe the reason is like 1 just you said.
   The project I aims to package has a dependeny for jmf.jar. But it hasn't
included in the jar. How can I include it?

Jane


2007/2/8, Markku Saarela <ma...@iki.fi>:
>
> Hi,
>
> There are at least two way to get this exception.
>
> 1. at other machines you dont have JMF api available for executable jar.
> 2. Somehow at other machine you MediaLocator constructor get wrong
> parameter.
>
> - markku
>
> Lan wrote:
> > Hi,Franz,
> >
> >    Thanks for your quick reply.
> >
> >    The error shows:
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > javax/media/NoPlayerException
> >
> > Actually, I have difined the MainClass in POM. But in my own machine, it
> > runs correctly.
> >
> > Jane
> >
> > 2007/2/7, franz see <fr...@gmail.com>:
> >>
> >>
> >> Good day to you, Jane,
> >>
> >> What do you mean by it can only be used in your machine? What error are
> >> you
> >> getting when used in another machine?
> >>
> >> Cheers,
> >> Franz
> >>
> >>
> >> Lan-6 wrote:
> >> >
> >> > Hi, all
> >> >
> >> >     I have generated an executable jar by using maven, (mvn package).
> >> The
> >> > jar includes the generated classes and main class.
> >> >     But it can only be used in my own machine. Shall I do some more
> >> > settings
> >> > to the project? What can I do?
> >> >
> >> >     Thanks advance!
> >> >
> >> > Jane
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: executable jar

Posted by Markku Saarela <ma...@iki.fi>.
Hi,

There are at least two way to get this exception.

1. at other machines you dont have JMF api available for executable jar.
2. Somehow at other machine you MediaLocator constructor get wrong 
parameter.

- markku

Lan wrote:
> Hi,Franz,
>
>    Thanks for your quick reply.
>
>    The error shows:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/media/NoPlayerException
>
> Actually, I have difined the MainClass in POM. But in my own machine, it
> runs correctly.
>
> Jane
>
> 2007/2/7, franz see <fr...@gmail.com>:
>>
>>
>> Good day to you, Jane,
>>
>> What do you mean by it can only be used in your machine? What error are
>> you
>> getting when used in another machine?
>>
>> Cheers,
>> Franz
>>
>>
>> Lan-6 wrote:
>> >
>> > Hi, all
>> >
>> >     I have generated an executable jar by using maven, (mvn package).
>> The
>> > jar includes the generated classes and main class.
>> >     But it can only be used in my own machine. Shall I do some more
>> > settings
>> > to the project? What can I do?
>> >
>> >     Thanks advance!
>> >
>> > Jane
>> >
>> >
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: executable jar

Posted by Lan <bl...@gmail.com>.
Hi,Franz,

    Thanks for your quick reply.

    The error shows:
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/NoPlayerException

Actually, I have difined the MainClass in POM. But in my own machine, it
runs correctly.

Jane

2007/2/7, franz see <fr...@gmail.com>:
>
>
> Good day to you, Jane,
>
> What do you mean by it can only be used in your machine? What error are
> you
> getting when used in another machine?
>
> Cheers,
> Franz
>
>
> Lan-6 wrote:
> >
> > Hi, all
> >
> >     I have generated an executable jar by using maven, (mvn package).
> The
> > jar includes the generated classes and main class.
> >     But it can only be used in my own machine. Shall I do some more
> > settings
> > to the project? What can I do?
> >
> >     Thanks advance!
> >
> > Jane
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: executable jar

Posted by franz see <fr...@gmail.com>.
Good day to you, Jane,

What do you mean by it can only be used in your machine? What error are you
getting when used in another machine?

Cheers,
Franz


Lan-6 wrote:
> 
> Hi, all
> 
>     I have generated an executable jar by using maven, (mvn package). The
> jar includes the generated classes and main class.
>     But it can only be used in my own machine. Shall I do some more
> settings
> to the project? What can I do?
> 
>     Thanks advance!
> 
> Jane
> 
> 

-- 
View this message in context: http://www.nabble.com/executable-jar-tf3186039s177.html#a8845369
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org