GeoTools : 6 Can Geotools2 be used on Mac OS X

Yes! But, Geotools code uses two java extensions: JAI and JAI Image IO. See 2.2 Dependencies for information about how to install these on Mac OS X.

With the JAI extension installed, most of the geotools codebase will build and pass tests, except for the gtopo30, reprojection (extra CS authority factories) and rendering-styling (tests) modules. The SpearfishSample code in the Maps and styles was tested and works.

The maven build process checks for the JAI Image IO extension, so you will need to comment this out to get it to build if you do not have this installed. Comment out the following section in the gt/maven.xml file:

Error rendering macro 'code': Invalid value specified for parameter 'lang'
<ant:available  classname="com.sun.media.imageio.stream.RawImageInputStream"
  property="imageio.present"/>
    <fail unless="imageio.present"
          message="JAI ImageIO extension not found.
Please download and install it from:
http://java.sun.com/products/java-media/jai/downloads/download-iio.html"
          />

With the pure java parts of the JAI Image IO installed, all of the geotools codebase (except rendering-styling) builds and passes tests, and you do not need to comment out the checks in maven.xml. However, this method of installing and using JAI Image IO is not well tested with geotools.

Comments:

When trying to build geotools on Mac OS X (I'm using 10.4.5) you might get an error like:

[INFO] ----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ----------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: sun.jdk
ArtifactId: tools
Version: 1.5

Reason: System artifact: sun.jdk:tools:jar:1.5 not found in path: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/../lib/tools.jar
  sun.jdk:tools:1.5:jar

 

The problem is that there is no tools.jar on Mac OS X. The analog for tools.jar on Mac OS X is classes.jar. A quick fix to allow the build to continue is to change the sun.jdk dependency in a pom.xml. For the branch 2.2.X, I had to make this change in 2.2.X/maven/javadoc/pom.xml:

<dependency>
      <groupId>sun.jdk</groupId>
      <artifactId>tools</artifactId>
      <version>1.5</version>
      <scope>system</scope>
      <!-- This line doesn't work on a Mac: <systemPath>${java.home}/../lib/tools.jar</systemPath> -->
      <systemPath>${java.home}/../Classes/classes.jar</systemPath>
    </dependency>

 

 

Posted by hohonuuli at Feb 17, 2006 16:58

mvn install:install-file -Dfile=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar -DgroupId=sun.jdk -DartifactId=tools -Dversion=1.5 -Dpackaging=jar -DgeneratePom=true

You can use this if you change the <scope> to 'provided' and remove the <systemPath/>

Posted by topping at Jul 06, 2006 18:47