Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


Praveen Chinthala
Jfree exception
1 Answer(s)      2 years and 6 months ago
Posted in : Development process


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.


Advertisement
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
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
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.
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
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 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 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 - 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
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
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
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
defined checked exception ââ?¬Å?InvalidCharcterFoundExceptionââ?¬Â? and creater a block of codes that will handle the exception
exception
exception  example for numberformat exception   Hi Friend, Try the following code: class NumberFormatExceptionEx{ public static void...); } catch(Exception e){ System.out.println(e
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
Dynamin Jfree chart in jsp---error
Dynamin Jfree chart in jsp---error   While compiling this CODE: <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <%@ page import="org.jfree.chart.ChartFactory" %> <%@ page
hybrid graph (jfree chart) - Swing AWT
hybrid graph (jfree chart)  hello i have a problem related to jfree chart.I want to display hybrid graph (Stacked Area and Line ).combination of stacked area chart and Line chart in one frame. Plese anybody help me out
JFree 3D Bar Chart not displaying in JSP - Java3D
JFree 3D Bar Chart not displaying in JSP  Hi I am trying to run JFree 3D bar chart written in your site under link: http://www.roseindia.net/chartgraphs/3Dbarchart-in-jsppage.shtml This is not working. PNG file
Create a Pie Chart in jsp Page using JFree Chart
Create a Pie Chart in jsp Page using JFree Chart  Hello Sir I followed ur tutorial on "CREATE A PIE CHART IN JSP PAGE USING JFREE CHART" and it worked fine.now i want a Little change in code .In my project first I have to view
exception handling
exception handling  explain about exception handling
Exception handling
Exception handling  how to resolve file not found error exception
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
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 handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Exception Handling
Exception Handling  create an exception class, which thros an exception if operand is non-numeric in claculating modules. ( Use command line arguments
 

 

 

DMCA.com