Ant Java Classpath

V

vnssoftware

Hi,
In build.xml for Ant:
The directory structure that comes from our Application Installer has
jars in several different directories. Can I set CLASSPATH using ; or
, in the Same Tag. Or do I have to use Seperate Tags for each new jar
location directory. I don't want to put all jars in one directory.
That will be a lot of work each time I install a new build.

Thank you!
 
W

Wendy S

vnssoftware said:
Hi,
The directory structure that comes from our Application Installer has
jars in several different directories. Can I set CLASSPATH using ; or
, in the Same Tag. Or do I have to use Seperate Tags for each new jar
location directory. I don't want to put all jars in one directory.
That will be a lot of work each time I install a new build.
Thank you!

Here's one way to do it:

<path id="project.classpath">
<pathelement location="${lib}\optional.jar"/>
<pathelement location="${lib}\struts.jar"/>
<pathelement location="${tomcat}\common\lib\servlet.jar" />
</path>

<target name="compile" depends="init,copy-props">
<javac srcdir="${srcdir}\share" destdir="${destdir}" deprecation="on"
debug="on">
<classpath refid="project.classpath"/>
</javac>
</target>
 
V

vnssoftware

Can
<pathelement location="${lib}\optional.jar"/>
<pathelement location="${lib}\struts.jar"/>
<pathelement location="${tomcat}\common\lib\servlet.jar" />
be replaced by something like this-

<pathelement location="${lib}\optional.jar,${tomcat}\common\lib\servlet.jar,{someotherdir}\struts.jar"/>

Thanks!
 
W

Wendy S

vnssoftware said:
Can
<pathelement location="${lib}\optional.jar"/>
<pathelement location="${lib}\struts.jar"/>
<pathelement location="${tomcat}\common\lib\servlet.jar" />
be replaced by something like this-
<pathelement
location="${lib}\optional.jar,${tomcat}\common\lib\servlet.jar,{someotherdir
}\struts.jar"/>

Go try it and see if it works, or else read the documentation:
http://ant.apache.org/manual/using.html#path

The answer to your question is yes, something LIKE that will work.
 
V

vnssoftware

Thanks.
If I want to compile just two java files in two different package
directory, how would the javac task look like in the ant script. Can I
do:
c:\...path to dir1\1.java;c:\...path to dir2\2.java
 
C

christian Ginouvet

Bonsoir,
Sous win 98,95, ME
ouvrir la fenetre DOS et taper ECHO si ECHO est actif ouvrir
Open bloc note et open autoexec.bak
pour que le SDK fonctionne inclure la commande SET CLASSPATH le fichier
contenant la bibliotheque java.tools.jar
exemple si le fichier tools.jar se trouve dans le dossier C:\javajdk\lib vous
devez ajouter la ligne suivante: SETCLASSPATH=%CLASSPATH%;.;\javajdk\lib\tools.
jar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top