Domanda

Is there an easy way to detect whether JAI's native binaries are installed?

JAI (Java Advanced Imaging) can run in multiple modes both with and without the native binaries that make it process images faster and also add support for additional formats. But, as the native libraries cannot be installed with Maven, how can you detect whether they're installed in the system?

È stato utile?

Soluzione

Documenting solution as it was difficult to find. The OpenGeo (GeoTools) toolkit provides a helper utility for checking whether the libraries are installed via it's ImageUtilities.

In summary:

  • check for the following classcom.sun.medialib.mlib.Image
  • check that it's not disabled via property: com.sun.media.jai.disableMediaLib
  • Instantiate com.sun.medialib.mlib.Image and execute isAvailable()

Code is available via LGPL [ http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/resources/image/ImageUtilities.java ]

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top