Ant Java Classpath

Discussion in 'Java' started by vnssoftware, Oct 27, 2003.

  1. vnssoftware

    vnssoftware Guest

    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!
     
    vnssoftware, Oct 27, 2003
    #1
    1. Advertising

  2. vnssoftware

    Wendy S Guest

    vnssoftware wrote:

    > 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>


    --
    Wendy in Chandler, AZ
     
    Wendy S, Oct 28, 2003
    #2
    1. Advertising

  3. vnssoftware

    vnssoftware Guest

    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!
     
    vnssoftware, Oct 28, 2003
    #3
  4. vnssoftware

    Wendy S Guest

    "vnssoftware" <> wrote in message
    news:...
    > 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.

    --
    Wendy in Chandler, AZ
     
    Wendy S, Oct 28, 2003
    #4
  5. vnssoftware

    vnssoftware Guest

    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
     
    vnssoftware, Nov 8, 2003
    #5
  6. vnssoftware

    Wendy S Guest

    vnssoftware wrote:

    > 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


    Go read the manual: http://ant.apache.org/manual/

    The docs for the 'javac' task give an example of EXACTLY what you're asking:
    http://ant.apache.org/manual/CoreTasks/javac.html

    --
    Wendy in Chandler, AZ
     
    Wendy S, Nov 9, 2003
    #6
  7. 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
    --
    Ce message a ete poste via la plateforme Web club-Internet.fr
    This message has been posted by the Web platform club-Internet.fr

    http://forums.club-internet.fr/
     
    christian Ginouvet, Nov 9, 2003
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ronald Fischer

    Ant javac : How to print classpath?

    Ronald Fischer, Sep 18, 2003, in forum: Java
    Replies:
    1
    Views:
    17,612
    Wayne Berke
    Sep 19, 2003
  2. Flip
    Replies:
    3
    Views:
    7,285
    Tony Morris
    Feb 9, 2004
  3. Gabe
    Replies:
    3
    Views:
    1,081
  4. Replies:
    2
    Views:
    759
  5. Replies:
    2
    Views:
    1,114
    Mike Schilling
    Mar 2, 2008
Loading...

Share This Page