Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect if JAI-ImageIo's native libraries are installed

Tags:

java

jai

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?

like image 402
adam Avatar asked Apr 15 '13 16:04

adam


1 Answers

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 ]

like image 118
adam Avatar answered Oct 23 '22 20:10

adam