[kepler-dev] using ant to detect J3D

Christopher Brooks cxh at eecs.berkeley.edu
Fri Jul 15 14:12:27 PDT 2005

Hi Dan,
Thanks, your solution is very cool!
I figured there would be a way to do this in Ant.

Seems like in principle, I could try converting configure in to
an Ant build script.

Another thing I need to figure out is how to build the jar files.
Currently, the makefiles create a jar file that contains the .class
files, other files listed in the OTHER_FILES_TO_BE_JARED makefile
variable and possibly the contents of jar files from subdirectories.

For example, ptolemy/actor/lib/lib.jar contains the .class files
in actor/lib, some other files like the icons and the contents of
files like ptolemy/actor/lib/io/io.jar etc.

This makes it very easy to create different Ptolemy configurations and
to create Web Start configurations.  I also use the contents of
the makefile to manage the contents of the release by checking for
junk files that should not be checked in to the tree.

Anyway, something to chew on.



    Hi Ilkay,
        You may have already figured this out, but I got interested in how 
    to detect if J3D is installed using ant.
        The clue was to look at the PT config to see how it is detected 
    there. There is a java file (java3DTest.java) in the PTII/config/ dir 
    that is used in the PT configure. Basically, they just try to compile 
    this file which import a class from J3D and if the compile works, then 
    J3D is installed; otherwise it is not.
        In Ant, we can use the Available and Condition tasks. For example, 
    this seems to work
      <!--target to detemine if java3D is available -->
      <target name="checkJ3D">
        <condition property="J3D.available">
          <available classname="javax.media.j3d.Canvas3D"/>
      <target name="hasJ3D" depends="checkJ3D" if="J3D.available">
        <echo>Java3D is available</echo>
    Running the target 'hasJ3D' will only run <echo> if the 
    'javax.media.j3d.Canvas3D' class is available (The choice of the 
    Canvas3D class was arbitrary). Simple replace any J3D specific 
    compilation commandswhere the <echo> is and it will only be compiled 
    when appropriate.
    Dan Higgins                                  higgins at nceas.ucsb.edu
    http://www.nceas.ucsb.edu/    Ph: 805-893-5127
    National Center for Ecological Analysis and Synthesis (NCEAS) 
    Marine Science Building - Room 3405
    Santa Barbara, CA 93195
    Kepler-dev mailing list
    Kepler-dev at ecoinformatics.org

More information about the Kepler-dev mailing list