On 13/11/2007, Kevin Du <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Sorry if this is a duplicate message. I send this out before
> subscribe.  Just want to make sure that it can actually be send out after
> subscribe.
>
> I am using my own manifest file by following
>
> <project>
>   ...
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>         ...
>         <configuration>
>           <archive>
>
>             
> <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
>           </archive>
>         </configuration>
>         ...
>       </plugin>
>     </plugins>
>   </build>
>   ...
> </project>
>
> I specified my class path in my manifest.mf file in the format of
> Class-Path: dir/xxx.jar dir/yyy.jar
>
> After mvn install, when I do java -jar myApp.jar it complains
> 'NoClassFound' for the class I specified in the class path. It took me an
> hour to find out the the MANIFEST.MF file in the generated jar has
> carriage returns in it.
>
> The generated manifest.mf file looks like
>
> Class-Path: /home/xxx/.m2/repository/com/xxx/xxx/mod
> el/1.0-SNAPSHOT/ model-1.0-SNAPSHOT.jar
>
> I guess that is why it complains NoClassFound, anybody any idea?


no - manifests that have long lines will normally have carriage returns,
with the continuing
line marked with an initial space - see the line length description for the
Jar manifest file:

   http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#JAR%20Manifest

   "No line may be longer than 72 bytes (not characters), in its
UTF8-encoded form.
    If a value would make the initial line longer than this, it should be
continued on
    extra lines (each starting with a single SPACE)."

so this is actually valid - your problem seems to be that you're using an
absolute path:

   /home/...

whereas the Class-Path entry expects relative paths - again from the same
Jar page:

   "The value of this attribute specifies the relative URLs of the
extensions or libraries
    that this application or extension needs. URLs are separated by one or
more spaces.
    The application or extension class loader uses the value of this
attribute to construct
    its internal search path.

so you should ensure that your classpath entries are relative to the
location of the Jar.

Thanks
>
> Kevin
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________




-- 
Cheers, Stuart

Reply via email to