Java Advanced Imaging (JAI) and 64 bit

From gvSIG CE Wiki

Jump to: navigation, search

Currently, gvSIG relies on the Java Advanced Imaging library (JAI) and its helper library, Advanced Image I/O, for raster data access. JAI consists of Java code and native binaries for each supported operating system, which can significantly speed up the data access.

Unfortunately, these libraries are no longer actively maintained (the last updates were about 5 years old at the time of writing). The biggest current problem is that there are no native binaries for 64 bit Windows and it seems there never will be (due to some obscure licensing issues -- proprietary software at its best). As a consequence, the JAI installer will fail to work on a Windows system with a 64 bit JDK.

On Mac OS X, JAI (but not the Image I/O tools) has been shipping with Mac OS X since 10.4. However, it is unclear what will happen to this 64 bit version of JAI in future versions of Mac OS X, since Apple changed its Java policy.

As an alternative, it is possible to install JAI without any native binaries. In that case, it will always fall back to using pure Java implementations. How much of a performance penalty this carries is unclear, as in the case of gvSIG most direct raster handling is done via the GDAL native binaries, anyway.

In any case, it is possible to download a ZIP archive with only the Java classes here.

Just unzip the file and drop the two JAR files it contains into the jre/lib/ext subfolder of your JDK (or into the lib/ext subfolder of your JRE). This will allow you to use the pure Java version of JAI from within a 64 bit JVM.

Installing a pure Java version of the Image I/O Tools library is a bit more tricky, since you cannot download only the JAR from the project file. Instead, find a 32 bit Windows or Linux system, where you can run one of the installers from the project's download page. After installation has completed, find the installed jai_imageio.jar file and copy it into your JDK/JRE as described above.

**TODO** Test the Image I/O installation, as described on this page, on a Linux system.