[kepler-dev] using ant to detect J3D
Dan Higgins
higgins at nceas.ucsb.edu
Fri Jul 15 13:02:01 PDT 2005
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"/>
</condition>
</target>
<target name="hasJ3D" depends="checkJ3D" if="J3D.available">
<echo>Java3D is available</echo>
</target>
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
--
*******************************************************************
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
*******************************************************************
More information about the Kepler-dev
mailing list