Installing the native JAI and ImageIO¶
The Java Advanced Imaging API (JAI) is an advanced image manipulation library built by Sun. GeoServer requires JAI to work with coverages and leverages it for WMS output generation. By default, GeoServer ships with the pure Java version of JAI, but installing the native JAI version in your JDK/JRE will increase the image handling performance significantly.
In particular, installing the native JAI is important for all raster processing, which is used heavily in both WMS and WCS to rescale, cut and reproject rasters. Installing the native JAI is also important for all raster reading and writing, which affects both WMS and WCS. Finally, native JAI is very useful even if there is no raster data involved, as WMS output encoding requires writing PNG/GIF/JPEG images, which are themselves rasters.
Native extensions are available for Windows (32 bit), Linux and Solaris (32 and 64 bit systems). Mac Os X 10.6 (probably 10.5 and 10.4 too) comes with JAI native extensions installed by default in /System/Library/Java/Extensions/. Unfortunately native ImageIO extensions are not available for Mac Os X.
Note
These installers are limited to allow adding native extensions to just one version of the JDK/JRE on your system. If native extensions are needed on multiple versions, manually unpacking the extensions will be necessary.
Note
These installers are also only able to apply the extensions to the currently used JDK/JRE. If native extensions are needed on a different JDK/JRE than that which is currently used, it will be necessary to uninstall the current one first, then run the setup program against the remaining JDK/JRE.
Installing native JAI on Windows¶
- Download JAI 1.1.3. At the time of writing only the 32 bit version of the installer is available, so if you are using a JDK, you will want to download jai-1_1_3-lib-windows-i586-jdk.exe, and if you are using a JRE, you will want to download jai-1_1_3-lib-windows-i586-jre.exe.
- Run the installer and point it to the JDK/JRE install that GeoServer will use to run.
- Download JAI Image I/O 1.1. At the time of writing only the 32 bit version of the installer is available, so if you are using a JDK, you will want to download jai_imageio-1_1-lib-windows-i586-jdk.exe, and if you are using a JRE, you will want to download jai_imageio-1_1-lib-windows-i586-jre.exe
- Run the installer and point it to the JDK/JRE install that GeoServer will use to run.
Installing native JAI on Linux¶
Download JAI 1.1.3, choosing the appropriate architecture:
Extract the file into a temporary directory
Move jar files in the JDK/JRE lib/ext folder.
Move so files in the JDK/JRE lib/amd64 folder.
For example, on an Ubuntu 64 bit system:
$ cd /tmp $ wget http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-amd64.tar.gz && \ gunzip -c jai-1_1_3-lib-linux-amd64.tar.gz | tar xf - && \ mv /tmp/jai-1_1_3/lib/*.jar $JAVA_HOME/jre/lib/ext/ && \ mv /tmp/jai-1_1_3/lib/*.so $JAVA_HOME/jre/lib/amd64/ && \ rm /tmp/jai-1_1_3-lib-linux-amd64.tar.gz && \ rm -r /tmp/jai-1_1_3
Download JAI Image I/O 1.1, choosing the appropriate architecture:
Estract the file into a temporary directory
Move jar files in the JDK/JRE lib/ext folder.
Move so files in the JDK/JRE lib/amd64 folder.
For example, on an Ubuntu 64 bit system:
$ cd /tmp $ wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-amd64.tar.gz && \ gunzip -c jai_imageio-1_1-lib-linux-amd64.tar.gz | tar xf - && \ mv /tmp/jai_imageio-1_1/lib/*.jar $JAVA_HOME/jre/lib/ext/ && \ mv /tmp/jai_imageio-1_1/lib/*.so $JAVA_HOME/jre/lib/amd64/ && \ rm /tmp/jai_imageio-1_1-lib-linux-amd64.tar.gz && \ rm -r /tmp/jai_imageio-1_1
Optional cleanup¶
Once the installation is complete, you may optionally remove the original JAI files from the GeoServer instance:
jai_core-x.y.z.jar
jai_imageio-x.y.jar
jai_codec-x.y.z.jar
where x
, y
, and z
refer to specific version numbers.