/    Sign up×
Community /Pin to ProfileBookmark

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.

to post a comment
Java

1 Comments(s)

Copy linkTweet thisAlerts:
@ashgonlineauthorApr 27.2005 — 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_RG?;

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.
×

Success!

Help @ashgonline spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...