www.webdeveloper.com
Results 1 to 2 of 2

Thread: NoClassDefFoundError in running Applets

  1. #1
    Join Date
    Apr 2005
    Posts
    6

    NoClassDefFoundError in running Applets

    Hi,
    I am using Jcharts for generating charts from Excel worksheets.My problem is that while running program using applets I get following error:
    java.lang.NoClassDefFoundError: org/jCharts/properties/ChartTypeProperties
    at JCTest27.init(JCTest27.java:36)
    at sun.applet.AppletPanel.run(AppletPanel.java:347)
    at java.lang.Thread.run(Thread.java:536)

    File is compiling without errors ,and further more there is no problem if I use frames .Then program is runnig Ok.
    What could be the cause,Please help me.

  2. #2
    Join Date
    Apr 2005
    Posts
    6

    Source code:Above query

    here is the source code for the problem as I listed before for NoClassDefFoundError:

    /***********************************************************************
    Application to draw line and Bar charts from Excel sheet data in Java
    ************************************************************************/

    import java.io.File;
    import java.util.Date;
    import java.util.Iterator;
    import jxl.*;

    import org.jCharts.Chart;
    import org.jCharts.chartData.DataSeries;
    import org.jCharts.chartData.ChartDataException;
    import org.jCharts.chartData.AxisChartDataSet;
    import org.jCharts.chartData.StockChartDataSet;
    import org.jCharts.properties.*;
    //import org.jCharts.properties.ChartTypeProperties;
    import org.jCharts.properties.util.ChartFont;
    import org.jCharts.test.TestDataGenerator;
    import org.jCharts.types.ChartType;
    import org.jCharts.axisChart.AxisChart;
    import org.jCharts.imageMap.*;

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.WindowEvent;
    import java.awt.image.BufferedImage;
    import java.awt.event.WindowAdapter;



    public class JCTest27 extends JApplet
    {
    public void init()
    {
    setBackground(Color.gray);
    PaintPanel p = new PaintPanel();
    Container c = getContentPane();
    c.add(p);
    }


    class PaintPanel extends JPanel
    {
    public void paint(Graphics gs)
    {
    Graphics2D g2 = (Graphics2D) gs;
    BufferedImage bufferedImage=new BufferedImage(800, 640, BufferedImage.TYPE_INT_RGB);

    try
    {
    Workbook workbook = Workbook.getWorkbook(new File("D:\\My Diary\\Imp Docs\\CAM e LEAN\\e2c_weekwiseutilisation_july04_june05-draft\\e2c_weekwiseutilisation_july04_june05-draft.xls"));
    Sheet sheet = workbook.getSheet("Currentyear data");
    Cell w[]=new Cell[5];

    for(int q=0;q<w.length;q++)
    {w[q]=sheet.getCell(0,q);}
    Cell a1 = sheet.getCell(0,1);
    String s[]=new String[5];

    for (int i = 0; i < s.length; ++i)
    {s[i]=w[i].getContents(); }
    for(int i=0;i<s.length;i++)
    {System.out.println(s[i]);}
    Cell a9=sheet.getCell(1,1);
    String h=a9.getContents();
    System.out.println("Reading cell "+h);
    String xAxis= "Week Starting on ";
    String[] xAxisLabels= { "7/5/2004","7/12/2004", "7/19/2004", "7/26/2004" };
    String yAxisTitle= "% Utilization on project Hours";
    String title= "Average Utilization Graph";
    /*********************************************************/
    /* Data for XaxisLabels is entered here */

    String xAxisLabels2[]=new String[34];
    Cell cl[]=new Cell[34];
    for(int i=0 ;i<34 ;i++)
    {cl[i]=sheet.getCell(i+1,1);}
    for(int i=0;i<34 ;i++)
    {xAxisLabels2[i]=cl[i].getContents(); }
    /*********************************************************/

    DataSeries dataSeries = new DataSeries( xAxisLabels2, xAxis, yAxisTitle, title );
    /* Data for coordinates of graph are entered here */
    String g[]=new String[34];
    double[][] r=new double[2][34];
    double[][] r1=new double[2][34];
    NumberCell[] nc=new NumberCell[34];
    Cell c[]=new Cell[34];
    NumberCell[] nc1=new NumberCell[34];
    Cell c1[]=new Cell[34];
    double s1[]=new double[34];
    double s2[]=new double[34];

    for (int i = 0; i <g.length; i++)
    { c[i]=sheet.getCell(i+1,20);
    nc[i]=(NumberCell) c[i];
    r[0][i]=nc[i].getValue();
    g[i]=(java.text.NumberFormat.getPercentInstance().format(r[0][i]).replace('%',' '));
    r[0][i]=Double.valueOf(g[i]).doubleValue();

    c1[i]=sheet.getCell(i+1,13);
    nc1[i]=(NumberCell) c1[i];
    r[1][i]=nc1[i].getValue();
    g[i]=(java.text.NumberFormat.getPercentInstance().format(r[1][i]).replace('%',' '));
    r[1][i]=Double.valueOf(g[i]).doubleValue();

    c[i]=sheet.getCell(i+1,16);
    nc[i]=(NumberCell) c[i];
    r1[0][i]=nc[i].getValue();
    g[i]=(java.text.NumberFormat.getPercentInstance().format(r1[0][i]).replace('%',' '));
    r1[0][i]=Double.valueOf(g[i]).doubleValue();

    c1[i]=sheet.getCell(i+1,26);
    nc1[i]=(NumberCell) c1[i];
    r1[1][i]=nc1[i].getValue();
    g[i]=(java.text.NumberFormat.getPercentInstance().format(r1[1][i]).replace('%',' '));
    r1[1][i]=Double.valueOf(g[i]).doubleValue();

    System.out.println("after Format"+r1[0][i]);

    }


    /****************************************************
    *****************************************************/


    try{ String[] legendLabels= { "Utilization % on Attendence hours","Average Utilization"};
    Paint[] paints={Color.blue,Color.black};
    Paint[] paints1={Color.red,Color.gray};
    Stroke[] strokes= new Stroke[ 2 ];
    strokes[ 0 ]= new BasicStroke( 1.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,1f, new float[]{ 1f, 1f, 1f, 1f}, .5f );
    strokes[ 1 ]= new BasicStroke( 1.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1f, new float[]{ 1f, 2f, 1f, 1f}, .5f );
    Shape[] shapes= { PointChartProperties.SHAPE_DIAMOND,PointChartProperties.SHAPE_DIAMOND};
    LineChartProperties lineChartProperties= new LineChartProperties( strokes, shapes );
    AxisChartDataSet axisChartDataSet= new AxisChartDataSet(r, legendLabels, paints, ChartType.LINE, lineChartProperties );
    dataSeries.addIAxisPlotDataSet( axisChartDataSet );
    /*****************************************************
    ********************************************************
    Data for bar chart is entered here
    **************************************************** */

    ClusteredBarChartProperties clusteredBarChartProperties= new ClusteredBarChartProperties();
    clusteredBarChartProperties.setWidthPercentage(5e-1f);
    AxisChartDataSet axisChartDataSet1= new AxisChartDataSet( r1, legendLabels, paints1, ChartType.BAR_CLUSTERED, clusteredBarChartProperties );
    dataSeries.addIAxisPlotDataSet( axisChartDataSet1 );

    ChartProperties chartProperties= new ChartProperties();
    AxisProperties axisProperties= new AxisProperties();
    DataAxisProperties n=(DataAxisProperties) axisProperties.getYAxisProperties();
    n.setUserDefinedScale(0,20);
    n.setRoundToNearest( 1 );
    n.setNumItems( 10 );
    ChartFont xScaleChartFont= new ChartFont( new Font( "Georgia Negreta cursiva", Font.PLAIN, 9 ), Color.black );
    axisProperties.getXAxisProperties().setScaleChartFont( xScaleChartFont );
    axisProperties.setXAxisLabelsAreVertical( true );
    axisProperties.getYAxisProperties().setShowGridLines (AxisTypeProperties.GRID_LINES_ONLY_WITH_LABELS );
    axisProperties.getXAxisProperties().setPaddingBetweenXAxisLabels(.1e-2f);
    LegendProperties legendProperties= new LegendProperties();
    legendProperties.setPlacement( LegendAreaProperties. BOTTOM);
    legendProperties.setNumColumns(1);
    AxisChart axisChart= new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, 800, 550);
    axisChart.setGraphics2D( bufferedImage.createGraphics() );
    axisChart.render();
    g2.drawImage( bufferedImage, 0, 0,this);

    }catch(Exception e){System.err.print(e);}

    }catch (Exception e){System.err.print(e);}


    }

    }
    }


    Please can anybody trace the problem <i m getting error code in running applet viewer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.15384 seconds
  • Memory Usage 2,857KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (2)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates