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

1

7

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?

Penmanship answered 15/4, 2013 at 16:14 Comment(0)
P
7

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 ]

Penmanship answered 15/4, 2013 at 16:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.