Jfree exception

Jfree exception

import java.sql.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.xy.*;
import org.jfree.data.*;

public class Chart{
public static void main(String arg[])throws Exception{
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "123" );
        Statement st=conn.createStatement();
        ResultSet rs=st.executeQuery("SELECT * from cricket_match");
  XYSeries series = new XYSeries("");
  while(rs.next()){

  series.add((double)rs.getInt("runs"),(double)rs.getInt("overs"));
  }
  XYDataset xyDataset = new XYSeriesCollection(series);
  JFreeChart chart = ChartFactory.createXYLineChart
  ("Match_Score", "Runs", "Overs", xyDataset, PlotOrientation.VERTICAL, true, true, false);
  ChartFrame frame1=new ChartFrame("",chart);
  frame1.setVisible(true);
  frame1.setSize(300,300);
  }
}

while running the program.......

Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at Chart.main(Chart.java:11)
Java Result: 1

i compiled the jfree program,,compiled without errors..but while running the program i got this message..what is this.

View Answers

January 17, 2012 at 12:04 PM

Have you imported your MySQL jdbc driver library into your jdk?









Related Tutorials/Questions & Answers:
Jfree exception
Jfree exception  import java.sql.*; import org.jfree.chart.... void main(String arg[])throws Exception{ Class.forName.......... Exception in thread "main" java.lang.ClassNotFoundException
Jfree exception
Jfree exception  import java.sql.*; import org.jfree.chart.... void main(String arg[])throws Exception{ Class.forName.......... Exception in thread "main" java.lang.ClassNotFoundException
Advertisements
jfree chart
jfree chart  i need donut chart using jfree
Artifacts of jfree
List of Artifacts of jfree maven depenency
exception
exception  wHEN RUNTIME EXCEPTION CLASS IS SUB OF EXCEPTION CLASS HOW CAN'T HANDLE UNCHECKED EXCEPTION
exception
exception  chek in and check out exception in java   Please visit the following link: Checked and Unchecked Exception
JFREE error again
JFREE error again  hi......... As i had asked u the jfree error i want to tel u that i have taken the both the jar files jfree and jcommon... running the code i am getting expection that: Exception in thread "main
exception
arguments are not equalto two,throw a user defined exception "invalid parameter exception" ,otherwise display the two parameters.   Here is an example... is not equal to two then invalid parameter exception is thrown ,otherwise display the two
exception
exception  what is the use of catch block even though we have predefined exception object
exception
exception  example for numberformat exception   Hi Friend, Try the following code:ADS_TO_REPLACE_1 class NumberFormatExceptionEx...); } catch(Exception e){ System.out.println(e
exception
defined checked exception ââ?¬Å?InvalidCharcterFoundExceptionââ?¬Â? and creater a block of codes that will handle the exception
Exception
Exception  whis is the Arithmetic Exception in java? or define Arithmetic Exception with exp?   Arithmetic Exception occurs, when you divide a number by zero. Example public class TryCatch { public static void main
Exception
Exception  public class FooException extends Exception { public..."); } public void calculate() throws FooException, Exception { try { int.... ex.printStackTrace(); System.exit(1); } catch(Exception ex
Exception
Exception   I was creating a table dynamically but it shows exception i.e shown down Suplier created0 Suplier created0 Suplier created0 Product created0 Product created0 Product created0 Product created0 could not fetch initial
exception
user defined unchecked exception  can we create user defined unchecked exceptions? if so what is the exact use of it in real time?   Please visit the following links: http://www.roseindia.net/java/java-exception/user
exception
exception  Identify the reason for SQLException exception, which is encountered when the developer tries to run the following code snippet to insert..."); ps.executeUpdate(); } catch(Exception e
JFREE error
JFREE error   hi......... the code for making chart is: WHICH IS GIVING THE ERROR import org.jfree.chart.*; import org.jfree.data.category.*; import org.jfree.data.general.DefaultPieDataset; import org.jfree.data.xy.
Version of jfree>jcommon dependency
Version of jfree>jfreechart dependency
Version of jfree>jfreereport dependency
JFree - Java Beginners
JFree  how to import JFree to jdk1.6.0_05, not to new version,, or how to get java new version (that used JFree ) ? regads  Hi friend, For solving the problem visit to : http://www.roseindia.net/chartgraphs
jfree - Java Beginners
jfree  how use the "import jfree" on jdk1.5.0_6,, or how to plot data in xy line on jdk1.5.0_6
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
jfree missing import file
jfree missing import file  hi....... i have checked the jar file of jfree that import file of RECTANGLEINSETS is not there then what to do now? how to solve this problem? plz help?   Download jcommon-1.0.16.jar
JFree chart package error
JFree chart package error  hi, I had asked u abt the jfree chart package and done what u have said. Its working but its giving me error that some... the jcommon jar file and jfree jar file for the bar chart code. but now its giving
Version of jfree>jfreechart-experimental dependency
Version of jfree>jfreechart-swt dependency
Version of jfree>jfreereport-ext dependency
jfree - Java Beginners
jfree  how use the "import jfree" on jdk1.5.0_6,,? or how to plot data in xy line on jdk1.5.0_6 ?  Hi friend, Code to solve...(300,300); } } For more information,Examples and Tutorials on jfree chart
JFREE chart - Java Beginners
JFREE chart  how can i get the latest save image of my action class?the previous one is the one i get every time there is a change in the database..thanks,i want my chart to display dynamically from my database  Hi
Jfree create error
Jfree create error  hi.............. thanks 4 ur help. as u said i have downloaded both the jar files and placed in jdk1.5 lib folder. but then also its giving the same error can u tel me why this is happening? and also u
Jfree create error
Jfree create error  hi.............. thanks 4 ur help. as u said i have downloaded both the jar files and placed in jdk1.5 lib folder. but then also its giving the same error can u tel me why this is happening? and also u
Jfree - Java Beginners
on jfree chart visit to : http://www.roseindia.net/chartgraphs/ Thanks
Jfree chart problem - Swing AWT
Jfree chart problem  hello i have a problem related to jfree chart i have some data and i want to display data in two different chart stacked area chart and line chart both in a single frame. That is hybrid combination
exception handling
exception handling  explain about exception handling
Pie chart Jfree create error
Pie chart Jfree create error  hi........... thanks 4 ur help but when i am using the code which has a import file import org.jfree.chart.*; its giving me an error that " package org.jfree.chart does not exists " can u help me
Exception handling
Exception handling  how to resolve file not found error exception
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks

Ads