hey,
im getting the exception

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com.sun.media.jai.codec.SeekableStream
	at javax.media.jai.operator.BMPDescriptor.class$(BMPDescriptor.java:65)
	at javax.media.jai.operator.BMPDescriptor.<clinit>(BMPDescriptor.java:87)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:186)
	at javax.media.jai.RegistryFileParser.getInstance(RegistryFileParser.java:224)
	at javax.media.jai.RegistryFileParser.registerDescriptor(RegistryFileParser.java:360)
	at javax.media.jai.RegistryFileParser.parseFile(RegistryFileParser.java:295)
	at javax.media.jai.RegistryFileParser.loadOperationRegistry(RegistryFileParser.java:55)
	at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:369)
	at javax.media.jai.JAI.<clinit>(JAI.java:382)
	at cbir.window1.ColorHistogram.<init>(ColorHistogram.java:61)
	at cbir.window1.SearchWindow.jButton1ActionPerformed(SearchWindow.java:92)
	at cbir.window1.SearchWindow.access$000(SearchWindow.java:22)
	at cbir.window1.SearchWindow$1.actionPerformed(SearchWindow.java:47)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6504)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
	at java.awt.Component.processEvent(Component.java:6269)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4860)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4686)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
	at java.awt.Container.dispatchEventImpl(Container.java:2273)
	at java.awt.Window.dispatchEventImpl(Window.java:2713)
	at java.awt.Component.dispatchEvent(Component.java:4686)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
	at java.awt.EventQueue.access$000(EventQueue.java:101)
	at java.awt.EventQueue$3.run(EventQueue.java:666)
	at java.awt.EventQueue$3.run(EventQueue.java:664)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:680)
	at java.awt.EventQueue$4.run(EventQueue.java:678)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

when im running the code :-

public class ColorHistogram {
    
    Image image;
    
    public ColorHistogram() throws ClassNotFoundException, SQLException{
        Connection con = null;
        Statement st;
        ResultSet rs = null;
        String url = "jdbc:mysql://localhost:3306/";
        String db = "image_db";
        String driver = "com.mysql.jdbc.Driver";
        String user = "root";
        String pass = "root";
        InputStream stream = null;
     
            Class.forName(driver);
            con = (Connection) DriverManager.getConnection(url + db, user, pass);          
            st = con.createStatement();
            String sql = "select image_path from image_details where id=1";          
            rs = st.executeQuery(sql);                           
            while (rs.next())
            {
                byte[] imagedata = rs.getBytes("image_path") ;
                image = Toolkit.getDefaultToolkit().createImage(imagedata);
                // Set up the parameters for the Histogram object.
                int[] bins = {256, 256, 256};             // The number of bins.
                double[] low = {0.0D, 0.0D, 0.0D};        // The low value.
                double[] high = {256.0D, 256.0D, 256.0D}; // The high value.
                // Construct the Histogram object.
                Histogram hist = new Histogram(bins, low, high);
                // Create the parameter block.
                ParameterBlock pb = new ParameterBlock();
                pb.addSource(image);               // Specify the source image
                pb.add(hist);                      // Specify the histogram
                pb.add(null);                      // No ROI
                pb.add(1);                         // Sampling
                pb.add(1);                         // periods
                // Perform the histogram operation.
                PlanarImage dst = (PlanarImage)JAI.create("histogram", pb, null);
                // Retrieve the histogram data.
                hist = (Histogram) dst.getProperty("histogram");
                // Print 3-band histogram.
                for (int i=0; i< hist.getNumBins().length; i++) {
                           System.out.println(hist.getBinSize(0, i) + " " );

                        }
             }
             
    }
    
}
.
.
.
 ColorHistogram ob = new ColorHistogram();
.
.

the code mentioned above is to create a colorhistogram of an image stored on a database...i've already added jai_core.jar file into my libraries folder...anyone help please...
thanks in advance :)

you're closing your class and still adding methods and code, I presume

how are you executing this code (command line or IDE) and how are you resolving your classpath?

you're closing your class and still adding methods and code, I presume

i dont get you..can u be more specific?? is there any problem on my code i've posted?

how are you executing this code (command line or IDE) and how are you resolving your classpath?

im executing the code through netbeans 7.0 IDE...and i've added the JAI jar file to my libraries folder..

i've solved the problem by including jai_codec.jar file into my libarary....thanks for everyone who replied.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.