ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harkness, David" <>
Subject RE: How to run a .jar created by ant
Date Tue, 14 Oct 2003 05:46:20 GMT
romalopes <> once said:
>   Using the ant I can cread the MSX.jar, but when I run this jar the
>   follow error appears: Exception in Thread "main"
> java.lang.NoclassDefFoundError: msx/MSX 
>   Another problem is how to use the classpath correctly.
> 	<target name="jarMSX" description="faz o jar do MSX">
> 		<jar destfile="${path.classpath}/MSX.jar">
> 			<fileset dir="${dir.bin}"/>
> 		    <fileset file="${xerces.home}/xerces.jar"/>
> 		    <fileset file="${path.classpath}/socket.jar"/>
> 		    <fileset file="CONFIGURACAO_MSX.xml"/>
> 		    <manifest >
> 			    <attribute name="Built-By"
> value="${}"/>
> 		    	<attribute name="Main-class" value="msx.MSX"/>
> 		    	<attribute name="Class-Path"
> value="${path.classpath}\socket.jar ${xerces.home}/xerces.jar""/>

> 		</manifest> </jar>
> 	</target>

I haven't done this myself, but from what I know of Ant and Java, I
suspect your problem is with the manifest's classpath. Keep in mind that
when you include the file


into your JAR, it strips the directory entirely. Thus you locate it as
"xerces.jar" without a path component. Similarly, when you include a
bunch of *.class files from a hierarchy, it strips the root
("${dir.bin}/") from the files and only includes the package hierarchy.

Given the above, you should merely have to change the "Class-Path" line
to this:

  <attribute name="Class-Path" value="socket.jar xerces.jar"/>

Hmm, you also have an extra close quote (/xerces.jar""/>) unless that's
just a typo. I figure Ant wouldn't run as the XML is invalid. Anyway,
give that a shot. :)

David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message