easy compilation of a package tree?

Discussion in 'Java' started by flupke, Jun 9, 2004.

  1. flupke

    flupke Guest

    Hi,

    i've created my own package and put the source tree under sources.
    (i'm using windows)
    Then i run a bat file with this content
    dir sources /s /b /a -D *.java > srcfiles.txt
    javac -d classes -cp
    ..;"..\lib\log4j-1.2.8.jar";"..\lib\dom4j-1.5-beta-2.jar" @srcfiles.txt

    I then end up with a classes dir that i can use to make a jar.
    Is there a better way of doing this? At home i also run linux so the dir
    sollution
    will not work. Is there another way of easily doing this?
    Is suspect that i can also use ant to do this?

    Thanks
     
    flupke, Jun 9, 2004
    #1
    1. Advertising

  2. flupke

    Danny Woods Guest

    flupke wrote:
    > i've created my own package and put the source tree under sources.
    > (i'm using windows)
    > Then i run a bat file with this content
    > dir sources /s /b /a -D *.java > srcfiles.txt
    > javac -d classes -cp
    > .;"..\lib\log4j-1.2.8.jar";"..\lib\dom4j-1.5-beta-2.jar" @srcfiles.txt
    >
    > I then end up with a classes dir that i can use to make a jar.
    > Is there a better way of doing this? At home i also run linux so the dir
    > sollution
    > will not work. Is there another way of easily doing this?
    > Is suspect that i can also use ant to do this?


    Have you looked at Apache's Ant build tool?

    http://ant.apache.org

    Danny.
     
    Danny Woods, Jun 9, 2004
    #2
    1. Advertising

  3. flupke

    lyallex Guest

    On Wed, 09 Jun 2004 13:36:43 GMT, "flupke"
    <> wrote:

    >Hi,
    >
    >i've created my own package and put the source tree under sources.
    >(i'm using windows)
    >Then i run a bat file with this content
    >dir sources /s /b /a -D *.java > srcfiles.txt
    >javac -d classes -cp
    >.;"..\lib\log4j-1.2.8.jar";"..\lib\dom4j-1.5-beta-2.jar" @srcfiles.txt
    >
    >I then end up with a classes dir that i can use to make a jar.
    >Is there a better way of doing this? At home i also run linux so the dir
    >sollution
    >will not work. Is there another way of easily doing this?
    >Is suspect that i can also use ant to do this?
    >
    >Thanks
    >


    Oh yes, you NEED ant for this.

    using ant it's as simple as telling ant where the source directory is
    and where the destination directory is and then using the javac task
    to get things done

    Along with some scaffolding this is all you need to do what your batch
    file is doing

    <target name="compile" >
    <javac srcdir="${src}" destdir="${dest}" >
    <classpath>
    <pathelement location="..\lib\log4j.jar"/>
    <pathelement location="..\lib\dom4j-1.5-beta-2.jar"/>
    <!-- etc etc -->
    </classpath>
    </javac>
    </target>

    Check out the jar task as well

    I couldn't even begin to imagine life without ant now.
    Go get it, it will transform your life.

    Rgds
    Lyall



    "Process- How will the work and the team be organized?
    The team needs to fit the culture in which it will operate,
    but you should write software well rather than preserve the
    irrationality of an enclosing culture" - Kent Beck
     
    lyallex, Jun 9, 2004
    #3
  4. flupke

    Sudsy Guest

    lyallex wrote:
    <snip>
    > I couldn't even begin to imagine life without ant now.
    > Go get it, it will transform your life.


    I whole-heartedly agree! Ant has even replaced shell scripts
    for my *NIX backups. It's a powerful tool which should find
    a place in everyone's arsenal.
     
    Sudsy, Jun 9, 2004
    #4
  5. flupke

    flupke Guest

    "flupke" <> schreef in bericht
    news:LnExc.1331$-ops.be...
    <snip>

    Thanks guys, i'll go check out ant!
     
    flupke, Jun 9, 2004
    #5
  6. flupke

    Jacob Guest

    flupke wrote:
    > Hi,
    >
    > i've created my own package and put the source tree under sources.
    > (i'm using windows)
    > Then i run a bat file with this content
    > dir sources /s /b /a -D *.java > srcfiles.txt
    > javac -d classes -cp
    > .;"..\lib\log4j-1.2.8.jar";"..\lib\dom4j-1.5-beta-2.jar" @srcfiles.txt
    >
    > I then end up with a classes dir that i can use to make a jar.
    > Is there a better way of doing this? At home i also run linux so the dir
    > sollution
    > will not work. Is there another way of easily doing this?
    > Is suspect that i can also use ant to do this?


    Ant is an option.
    Many prefer make: http://geosoft.no/javamake.html
     
    Jacob, Jun 9, 2004
    #6
    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. Hazzard
    Replies:
    2
    Views:
    649
    Hazzard
    Apr 6, 2004
  2. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,127
  3. Sune
    Replies:
    10
    Views:
    582
    Martin Ambuhl
    Oct 7, 2005
  4. Bruno Desthuilliers
    Replies:
    5
    Views:
    394
    Bruno Desthuilliers
    Aug 29, 2007
  5. C__chp
    Replies:
    4
    Views:
    509
    Puppet_Sock
    Feb 15, 2008
Loading...

Share This Page