java.lang.ClassNotFoundException:it.geosolutions.jaiext.range.Range [英] java.lang.ClassNotFoundException: it.geosolutions.jaiext.range.Range

查看:196
本文介绍了java.lang.ClassNotFoundException:it.geosolutions.jaiext.range.Range的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在GeoTools上启动了我的第一个程序,在该程序中我还使用了JAI- Java Advanced Imaging.我发现以下错误

I recently started my first program with GeoTools in which i was also using JAI- Java Advanced Imaging. I found following error

线程"main"中的异常java.lang.NoClassDefFoundError:it/geosolutions/jaiext/range/Range 在it.geosolutions.jaiext.crop.CropDescriptor.(CropDescriptor.java:62) 在it.geosolutions.jaiext.crop.CropSpi.updateRegistry(CropSpi.java:56) 在javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2056) 在javax.media.jai.ThreadSafeOperationRegistry.registerServices(ThreadSafeOperationRegistry.java:620) 在javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:373) 在javax.media.jai.JAI.(JAI.java:566) 在com.rgb.NDRI.createNDI(NDRI.java:17) 在com.rgb.RGBSpliter.main(RGBSpliter.java:71) 引起原因:java.lang.ClassNotFoundException:it.geosolutions.jaiext.range.Range 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:366) 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:355) 在java.security.AccessController.doPrivileged(本机方法) 在java.net.URLClassLoader.findClass(URLClassLoader.java:354) 在java.lang.ClassLoader.loadClass(ClassLoader.java:425) 在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308) 在java.lang.ClassLoader.loadClass(ClassLoader.java:358) ...另外8个

Exception in thread "main" java.lang.NoClassDefFoundError: it/geosolutions/jaiext/range/Range at it.geosolutions.jaiext.crop.CropDescriptor.(CropDescriptor.java:62) at it.geosolutions.jaiext.crop.CropSpi.updateRegistry(CropSpi.java:56) at javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2056) at javax.media.jai.ThreadSafeOperationRegistry.registerServices(ThreadSafeOperationRegistry.java:620) at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:373) at javax.media.jai.JAI.(JAI.java:566) at com.rgb.NDRI.createNDI(NDRI.java:17) at com.rgb.RGBSpliter.main(RGBSpliter.java:71) Caused by: java.lang.ClassNotFoundException: it.geosolutions.jaiext.range.Range at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 8 more

以上是我在控制台中看到的内容.我不知道geotools 14.4中的所有jar中都缺少哪个jar.

The above is what I see in console. I do not know out of all jars in geotools 14.4 which jar is missing.

代码如下

 package com.rgb;
 import java.awt.image.DataBuffer;
 import java.awt.image.RenderedImage;
 import java.awt.image.renderable.ParameterBlock;
 import java.io.File;
 import java.io.IOException;

 import javax.imageio.ImageIO;
 import javax.media.jai.*;

 public class NDRI {
 public void createNDI(String file1,String file2) throws IOException{
     // First we open the input images. We assume that each band is in a separate file.
     // We assume that the first image is a near infrared one and that the second is
     // a visible red image -- if you're using Landsat images, those will be bands
     // 4 and 3, respectively.
     PlanarImage iNIR = JAI.create("fileload",file1);
     PlanarImage iVIS = JAI.create("fileload",file2);
     // The pixels on those images must be processed as floating-point values!
     ParameterBlock pbConvert = new ParameterBlock();
     pbConvert.addSource(iNIR);
     pbConvert.add(DataBuffer.TYPE_DOUBLE);
     PlanarImage NIR = JAI.create("format", pbConvert);
     pbConvert = new ParameterBlock();
     pbConvert.addSource(iVIS);
     pbConvert.add(DataBuffer.TYPE_DOUBLE);
     PlanarImage VIS = JAI.create("format", pbConvert);    
     // Calculate the denominator (NIR-VIS).
     ParameterBlock pbd = new ParameterBlock();
     pbd.addSource(NIR);
     pbd.addSource(VIS);
     PlanarImage denominator = JAI.create("subtract",pbd);
     // Calculate the numerator (NIR+VIS).
     ParameterBlock pbn = new ParameterBlock();
     pbn.addSource(NIR);
     pbn.addSource(VIS);
     PlanarImage numerator = JAI.create("add",pbd);
     // Calculate the NDVI.
     ParameterBlock pbNDVI = new ParameterBlock();
     pbNDVI.addSource(denominator);
     pbNDVI.addSource(numerator);
     RenderedImage ndvi = JAI.create("divide",pbNDVI);
     String format="png";
     ImageIO.write(ndvi, format, new File("E:/ndvi_output.png"));

     // Create a GUI to show it. 
    /* JFrame frame = new JFrame("NDVI image");
     DisplayNBImage disp = new DisplayNBImage(ndvi);
     frame.add(new JScrollPane(disp));
     frame.pack();
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.setVisible(true);*/

     /*  PlanarImage iNIR = JAI.create("fileload","E:/output/image_red.png");
     PlanarImage iVIS = JAI.create("fileload","E:/output/image_green.png");
     // The pixels on those images must be processed as floating-point values!
     ParameterBlock pbConvert = new ParameterBlock();
     pbConvert.addSource(iNIR);
     pbConvert.add(DataBuffer.TYPE_DOUBLE);
     PlanarImage NIR = JAI.create("format", pbConvert);
     pbConvert = new ParameterBlock();
     pbConvert.addSource(iVIS);
     pbConvert.add(DataBuffer.TYPE_DOUBLE);
     PlanarImage VIS = JAI.create("format", pbConvert);    
     // Calculate the denominator (NIR-VIS).
     ParameterBlock pbd = new ParameterBlock();
     pbd.addSource(NIR);
     pbd.addSource(VIS);
     PlanarImage denominator = JAI.create("subtract",pbd);
     // Calculate the numerator (NIR+VIS).
     ParameterBlock pbn = new ParameterBlock();
     pbn.addSource(NIR);
     pbn.addSource(VIS);
     PlanarImage numerator = JAI.create("add",pbd);
     // Calculate the NDVI.
     ParameterBlock pbNDVI = new ParameterBlock();
     pbNDVI.addSource(denominator);
     pbNDVI.addSource(numerator);
     PlanarImage ndvi = JAI.create("divide",pbNDVI);
     double[][] matrix1 = {{ 1./3, 1./3, 1./3, 0 }};
     ParameterBlock pb = new ParameterBlock();
      pb.addSource(ndvi);
      pb.add(matrix1);*/

     /* PlanarImage dst = (PlanarImage) JAI.create("bandCombine",pb);



      BufferedImage img = dst.getAsBufferedImage();
     ImageIO.write(img, format, new File("E:/output/ndvi_output.png"));
     System.out.println("ndvi gray scale image created");*/
}
}

推荐答案

我在这里找到了缺少的Range类: https ://github.com/geosolutions-it/jai-ext/tree/master/jt-utilities/src/main/java/it/geosolutions/jaiext/range

I found the missing Range class here: https://github.com/geosolutions-it/jai-ext/tree/master/jt-utilities/src/main/java/it/geosolutions/jaiext/range

因此,请尝试将jt实用程序和jt迭代器添加到您的项目中.

So, try to add jt-utilities and jt-iterators to your project.

这篇关于java.lang.ClassNotFoundException:it.geosolutions.jaiext.range.Range的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆