The issue is not related to javax.mail it is with the specification of your
main class.

In mainClass you have to put the fully qualified path to the class

like in <mainClass>pa.cka.ge.ANNEX</mainClass> (if that is your main class)

And if you require javax.mail you will have to add it to the class path when
you execute it

something like:

java -cp mail.jar -jar ANNEX.jar



On Tue, Jul 19, 2011 at 10:16 PM, Abdul Hakim <[email protected]>wrote:

> Hello,
>
> Im trying to build a project which requires the mail.jar from Sun. it runs
> perfectly in Netbeans. However, when I tried compiling it with maven, it
> produces a jar file that will display this error message when I tried to
> execute it : Could not find the main class : ANNEX.Program will exit.
> This is the content of my POM:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd";>
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>com.mycompany.app</groupId>
>  <artifactId>ANNEX</artifactId>
>  <packaging>jar</packaging>
>  <version>1.0</version>
>  <name>ANNEX</name>
>  <url>http://maven.apache.org</url>
>
>  <build>
>    <plugins>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-jar-plugin</artifactId>
>        <configuration>
>          <archive>
>            <manifest>
>              <addClasspath>true</addClasspath>
>              <mainClass>ANNEX</mainClass>
>            </manifest>
>
>          </archive>
>                  <resources>
>        <resource>
>          <directory>src/main/resources</directory>
>          <filtering>true</filtering>
>        </resource>
>        <resource>
>          <directory>src/main/non-packaged-resources</directory>
>          <filtering>true</filtering>
>          <targetPath>..</targetPath>
>        </resource>
> </resources>
>
>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
>
>
>
>  <dependencies>
>  <dependency>
>      <groupId>junit</groupId>
>      <artifactId>junit</artifactId>
>      <version>3.8.1</version>
>      <scope>test</scope>
>    </dependency>
>    <dependency>
>      <groupId>javax.mail</groupId>
>      <artifactId>mail</artifactId>
>      <version>1.4.4</version>
>    </dependency>
>
>
>  </dependencies>
> </project>
>
>
> Please help me. Thanks
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/HELP-javax-mail-could-not-find-the-main-class-tp4614483p4614483.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Those who do not understand Unix are condemned to reinvent it, poorly.
Any sufficiently recent Microsoft OS contains an ad hoc,
informally-specified, bug-ridden, slow implementation of half of Unix.

Reply via email to