0

I was running a geoscript-groovy tutorial code:

groovy:000> import geoscript.layer.GeoTIFF
groovy:000> format = new GeoTIFF()
groovy:000> raster = format.read(new File("raster.tif"))

, and got the follow errors:

ERROR java.lang.NoClassDefFoundError:
javax/media/jai/ImageLayout

I have limited knowledge about JAI. I don't know whether this is a general JDK configuration issue or an issue with groovy etc.

My questions are:

What's the cause of this error associated with javax.media.jai.ImageLayout and how to fix it? How do I verify if javax.media.jai.ImageLayout is really installed.

Thanks

P.S. The software environment is Ubuntu 12.04 with:

$java -version
java version "1.6.0_32"
OpenJDK Runtime Environment (IcedTea6 1.13.4) (6b32-1.13.4-4ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

$groovy -v
Groovy Version: 1.8.6 JVM: 1.6.0_32 Vendor: Sun Microsystems Inc. OS: Linux

-- UPDATE --

I changed JDK to oracle

$ java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)

and still I am getting the following error:

ERROR java.lang.NoClassDefFoundError:
javax/media/jai/ImageLayout
        at org.geotools.gce.geotiff.GeoTiffFormat.getReader (GeoTiffFormat.java:287)
        at org.geotools.gce.geotiff.GeoTiffFormat$getReader.call (Unknown Source)

Also, the commands I used to install Oracle JDK are:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

I also did

sudo apt-get install libjai-core-java libjai-imageio-core-java

and I am still getting the same error.

thor
  • 21,418
  • 31
  • 87
  • 173

1 Answers1

0

To use javax.media.jai.ImageLayout you need an Oracle JDK. It's not present in OpenJDK. I don't know the library you're using so I can't tell you if there is any option to e.g. inject different strategy for image manipulation. Switch to Oracle JDK and test if it works for you that way.

Szymon Stepniak
  • 40,216
  • 10
  • 104
  • 131