Results 1 to 12 of 12
Thread: Adding jfreechart
- 08-17-2011, 06:00 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
- 08-18-2011, 08:14 AM #2
You can extract it anywhere. I use Linux, and I like to keep Java jars in $HOME/lib/java.
To run a program from the command line that uses a jar, include the jar file in the -cp switch:
The "." in the classpath means the current directory. The ":" separates locations in the classpath. Be aware that the path separator is different on different systems. I think it's ";" on Windows. Also, the directory separators are different. Your cp might be ".;C:\java\jars\jfreechart.jar" or something.Java Code:java -cp .:/path/to/jfreechart.jar package.ClassToRun
Newer versions of the JVM (since 1.6, I think) can also use wildcards in the classpath. So if you have a directory full of jars, you can use /path/to/jars/*.jar in your classpath.Last edited by kjkrum; 08-18-2011 at 08:18 AM.
Get in the habit of using standard Java naming conventions!
- 08-18-2011, 11:59 AM #3
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
THANKS :D
This should be written in tutorials for begginers like myself!
You've been of amazing help! thank you!
- 08-18-2011, 12:27 PM #4
I'm sure it is written in a tutorial somewhere. Some people on these forums will just post links as answers. But sometimes I like to write my own answers. Forcing myself to think about the answers keeps me sharp. :)
Get in the habit of using standard Java naming conventions!
- 08-18-2011, 12:35 PM #5
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
Thanks! It's the right to do I think :)
But I tried to try a code from the Internet using jfreecharts to start getting familiar with it, and I got an exception that says:
is it a problem with the code? there's one simple sample I tried:Java Code:Exception in thread "main" java.lang.NoSuchMethodError: org.jfree.ui.RectangleInsets.<init>(DDDD)V at org.jfree.chart.axis.Axis.<clinit>(Axis.java:146) at org.jfree.chart.StandardChartTheme.<init>(StandardChartTheme.java:227) at org.jfree.chart.ChartFactory.<clinit>(ChartFactory.java:229) at pie.main(pie.java:22)
Java Code:import java.awt.*; import org.jfree.chart.*; import org.jfree.chart.title.*; import org.jfree.data.general.DefaultPieDataset; import org.jfree.ui.*; import org.jfree.chart.plot.*; import org.jfree.util.*; public class pie{ public static void main(String arg[]){ DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("One", new Integer(10)); pieDataset.setValue("Two", new Integer(20)); pieDataset.setValue("Three", new Integer(30)); pieDataset.setValue("Four", new Integer(10)); pieDataset.setValue("Five", new Integer(20)); pieDataset.setValue("Six", new Integer(10)); JFreeChart chart = ChartFactory.createPieChart3D ("3D Pie Chart", pieDataset, true,true,true); PiePlot3D p=(PiePlot3D)chart.getPlot(); p.setForegroundAlpha(0.5f); ChartFrame frame1=new ChartFrame("3D Pie Chart",chart); frame1.setVisible(true); frame1.setSize(300,300); } }
- 08-18-2011, 12:36 PM #6
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
Yea, and I didnt know where should I go to read about it and how to use it. I thought I wouldve tried to know the problem from reading about it.
- 08-18-2011, 01:10 PM #7
NoSuchMethodError happens when you take a program compiled against one version of a library and run it with a different version of the library that's missing a method. If you tried to recompile the program, you'd get a compiler error.
A good thing to do when you get error messages is read about the error class in the API docs. Just Google "java nosuchmethoderror 6" or whatever. The "6" is because I'm interested in the docs for Java 1.6. (1.7 just came out, and I don't trust it yet.)Get in the habit of using standard Java naming conventions!
- 08-18-2011, 01:15 PM #8
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
So I have got missing methods? Is this the problem?
Then where can I go to know the methods available for me?
i have jdk 7. But for some reasons I dont know I dont have some libraries in the java 1.7..
Thanks
- 08-18-2011, 01:24 PM #9
So you're compiling your own code, and it compiles without error, but then you get a NoSuchMethodError when you run it? That's weird. Maybe there's a version mismatch between classes inside the jfreechart jar.
Get in the habit of using standard Java naming conventions!
- 08-18-2011, 01:28 PM #10
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
Yes I get no compilation errors.
So the problem in the jfreecharts zipped file i downloaded? Im sorry because Im not getting it clearly :)
- 08-18-2011, 01:58 PM #11
- 08-18-2011, 02:02 PM #12
Member
- Join Date
- Jul 2011
- Posts
- 28
- Rep Power
- 0
Similar Threads
-
Jfreechart
By aaruviswa in forum Web FrameworksReplies: 2Last Post: 03-17-2011, 06:51 AM -
JfreeChart
By puk284 in forum Advanced JavaReplies: 1Last Post: 05-12-2009, 04:52 PM -
[SOLVED] Little help on adding a jfreechart graph to Jpanel
By Manfizy in forum New To JavaReplies: 5Last Post: 02-25-2009, 08:01 AM -
JFreeChart 1.0.11
By Java Tip in forum Java SoftwareReplies: 0Last Post: 09-26-2008, 07:52 PM -
JFreeChart 1.0.8
By JavaBean in forum Java SoftwareReplies: 0Last Post: 11-27-2007, 08:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks