ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claudio Corsi <cco...@progress.com>
Subject Re: How to run a .jar created by ant
Date Tue, 14 Oct 2003 12:43:22 GMT
There are some things here that you need to keep in mind.

Java will not be able to find a jar file that is included within a jar 
file. In your case, you should not include the xerces.jar and socket.jar 
file in your MSX.jar file.

When using the -jar option and your Manifest includes a Class-Path 
attribute. The jar files are resolved relative to the executed jar file. 
In your case, you should remove the full qualified path name for the 
xerces.jar and socket.jar. You need to only require that these jar files 
are located in the same directory that the MSX.jar file is located.

As for the exception, what is the command that you are using to start 
the Main program?

romalopes wrote:

>Friends,
>    
>  I´m new using ant, but I alread have a problem.
>
>  I´m used to construct my package .jar in the eclipse, but I figure 
>out to use de ant.  Using eclise it works without any problem.
>  
>  I have a class in a package: msx.MSX .  This class has that method 
>main(...).
>  
>  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="${user.name}"/>
>		    	<attribute name="Main-class" value="msx.MSX"/>
>		    	<attribute name="Class-Path" 
>value="${path.classpath}\socket.jar ${xerces.home}/xerces.jar""/>
>		    </manifest>
>		</jar>
>	</target>
>
> 
>
>   Thanks Anderson.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message