Problem running the JFreeChartDemo
Problem running the JFreeChartDemo
Hi hi,
As a newbie, I'm having problem with the installation of this JFreeChart..
First of all, I followed the installation instructions from the installation document..then I try to run the demo by doing this:
java -classpath jfreechart-0.8.1.jar;jcommon-0.6.1.jar com.jrefinery.chart.demo.JFreeChartDemo
and I got this error:
Exception in thread "main" java.lang.NoClassDefFoundError : com/jrefinery/chart/demo/JFreeChartDemo
I've search the Forum and found a similar thread with the same problem but seems as if there wasn't a solution in the end as well?
I'm wondering how do I get about fixing this problem? Is my classpaths wrong or what?
btw..I set added a new path to my Window system which points to the directory that holds the two JAR files jcommon and jfreechart.
Any ideas? Thanks!
Regards,
YJ
As a newbie, I'm having problem with the installation of this JFreeChart..
First of all, I followed the installation instructions from the installation document..then I try to run the demo by doing this:
java -classpath jfreechart-0.8.1.jar;jcommon-0.6.1.jar com.jrefinery.chart.demo.JFreeChartDemo
and I got this error:
Exception in thread "main" java.lang.NoClassDefFoundError : com/jrefinery/chart/demo/JFreeChartDemo
I've search the Forum and found a similar thread with the same problem but seems as if there wasn't a solution in the end as well?
I'm wondering how do I get about fixing this problem? Is my classpaths wrong or what?
btw..I set added a new path to my Window system which points to the directory that holds the two JAR files jcommon and jfreechart.
Any ideas? Thanks!
Regards,
YJ
Re: Problem running the JFreeChartDemo
The command you gave is correct, so it should work.
One thing to check is that you didn't inadvertantly type 'com/jrefinery/chart/demo/JFreeChartDemo' instead of 'com.jrefinery.chart.demo.JFreeChartDemo', that's a pretty easy mistake to make (I know because I've done it before!)
Regards,
DG.
One thing to check is that you didn't inadvertantly type 'com/jrefinery/chart/demo/JFreeChartDemo' instead of 'com.jrefinery.chart.demo.JFreeChartDemo', that's a pretty easy mistake to make (I know because I've done it before!)
Regards,
DG.
Re: Problem running the JFreeChartDemo
Hi David,
Thanks for conforming with me but it still does not work at all. I'm still getting the same error...
Any other ideas of why this didn't work?
Thanks!
Regards,
YJ
Thanks for conforming with me but it still does not work at all. I'm still getting the same error...
Any other ideas of why this didn't work?
Thanks!
Regards,
YJ
Re: Problem running the JFreeChartDemo
Are you typing the command from the same directory as the jar files? Otherwise, you need to put:
java -classpath path/to/jarfiles/jfreechart-0.8.1.jar;path/to/jarfiles/jcommon-0.6.1 ...
Regards,
DG.
java -classpath path/to/jarfiles/jfreechart-0.8.1.jar;path/to/jarfiles/jcommon-0.6.1 ...
Regards,
DG.
Re: Problem running the JFreeChartDemo
Do you mean that I am suppose to go to the directory that contains the jcommon and jfreechart JAR files?? Cause if that's what you meant, I tried that too but it still gives me the same error.
Anyway...it just occurred to me to try and compile the demo files using JCreator and when I do that, the following errors show:
C:\jdk1.3\jfreechart-0.8.1\source\com\jrefinery\chart\demo\LineChartDemo1.java:8: cannot resolve symbol
symbol : class DefaultCategoryDataset
location: package data
import com.jrefinery.data.DefaultCategoryDataset;
^
Occured to me that is it possible that my path has been set wrongly? I added a path that points to the jfreechart-0.8.1/jars folder...but now I'm wondering is that correct or should i have put it to point to the jfreechart-0.8.1/source folder since the com folders and all that actually resides in this folder instead of the jars folder..
please advice and thanks for the fast reply =)
Regards,
YJ
Anyway...it just occurred to me to try and compile the demo files using JCreator and when I do that, the following errors show:
C:\jdk1.3\jfreechart-0.8.1\source\com\jrefinery\chart\demo\LineChartDemo1.java:8: cannot resolve symbol
symbol : class DefaultCategoryDataset
location: package data
import com.jrefinery.data.DefaultCategoryDataset;
^
Occured to me that is it possible that my path has been set wrongly? I added a path that points to the jfreechart-0.8.1/jars folder...but now I'm wondering is that correct or should i have put it to point to the jfreechart-0.8.1/source folder since the com folders and all that actually resides in this folder instead of the jars folder..
please advice and thanks for the fast reply =)
Regards,
YJ
Re: Problem running the JFreeChartDemo
You do not need to compile the demo file or what is in the source. The demo is located in the jar file so running the command as David suggested should work.
Also, pointing to the jars directory is insufficient. You will need to point directly to each jar (or zip) file.
Alternatively, you can point to the source directory if you plan on modifying classes, etc. In order to do so, and to compile the code, you will need to make sure that the jcommon jar is in your classpath, or download the jcommon source, etc, etc.
Finally, I would seriously suggest that you do not place non Sun java jars and code in your jdk directory. If you upgrade to a new jdk, then anything that you have set (environment variables, batch files, and so on) will need to be changed. Better to create a commond directory and keep third party code there (for example, c:\classes).
For some helpful info on setting classpath, java.sun.com has some good resources. Here is one pointer:
http://java.sun.com/docs/books/tutorial ... win32.html
Also, pointing to the jars directory is insufficient. You will need to point directly to each jar (or zip) file.
Alternatively, you can point to the source directory if you plan on modifying classes, etc. In order to do so, and to compile the code, you will need to make sure that the jcommon jar is in your classpath, or download the jcommon source, etc, etc.
Finally, I would seriously suggest that you do not place non Sun java jars and code in your jdk directory. If you upgrade to a new jdk, then anything that you have set (environment variables, batch files, and so on) will need to be changed. Better to create a commond directory and keep third party code there (for example, c:\classes).
For some helpful info on setting classpath, java.sun.com has some good resources. Here is one pointer:
http://java.sun.com/docs/books/tutorial ... win32.html
Re: Problem running the JFreeChartDemo
Hi
Since my last visit to this forum, I've made several changes..among them is placing the jfreechart jar files into another directory that is independent to the jdk.
However, I'm still very much facing the same problem...I still can't run the demo file.
My classpaths are also changed to set at pointing to the two jar files as well.
The reason why I decided to try compiling this is that when I went in search for the class files at the com/jrefinery/chart/demo folder..I've found them all to be java files instead of class files which is most probably why the NoClassDefError...
Next, I tried making a new project in JCreator and to compile the JFreeChartDemo.java there...and the following error was given:
C:\jfc\JFreeChartDemo.java:95: package com.jrefinery.data does not exist
import com.jrefinery.data.*;
^
I am incline to think that this is due to some wrong classpath settings but I have no idea what else am I suppose to do anymore...
please advice..
thanks
Since my last visit to this forum, I've made several changes..among them is placing the jfreechart jar files into another directory that is independent to the jdk.
However, I'm still very much facing the same problem...I still can't run the demo file.
My classpaths are also changed to set at pointing to the two jar files as well.
The reason why I decided to try compiling this is that when I went in search for the class files at the com/jrefinery/chart/demo folder..I've found them all to be java files instead of class files which is most probably why the NoClassDefError...
Next, I tried making a new project in JCreator and to compile the JFreeChartDemo.java there...and the following error was given:
C:\jfc\JFreeChartDemo.java:95: package com.jrefinery.data does not exist
import com.jrefinery.data.*;
^
I am incline to think that this is due to some wrong classpath settings but I have no idea what else am I suppose to do anymore...
please advice..
thanks
Re: Problem running the JFreeChartDemo
Hi,
Instrucitons in README are for Linux (: instead of windoze;) and the subdir jars is ommitted. Classpath problem is typical problem when you start with java. Just fight it, it finally will work!
Just go in the root dir where you unzipped JFreeChart (that is where the readme file is) and type:
java -classpath jars\jcommon-0.6.1.jar;jars\jfreechart-0.8.1.jar; com.jrefinery.chart.demo.JFreeChartDemo
That is, on windows.
hope this helps,
Michiel
Instrucitons in README are for Linux (: instead of windoze;) and the subdir jars is ommitted. Classpath problem is typical problem when you start with java. Just fight it, it finally will work!
Just go in the root dir where you unzipped JFreeChart (that is where the readme file is) and type:
java -classpath jars\jcommon-0.6.1.jar;jars\jfreechart-0.8.1.jar; com.jrefinery.chart.demo.JFreeChartDemo
That is, on windows.
hope this helps,
Michiel
Re: Problem running the JFreeChartDemo
It WORKS!!!! 
HAHHAHAA!!! It finally worked!!!!
Thank you soooo much Michiel!!!
I had to type in the jars\ and it works after that
WOW!
Finally...thank you so much to David and Michiel...
By the way...a last question...If I'm to run the codes in a Java editor, I'll have to import the packages and do I have to configure the compiler's setting as well or something? Such as setting the classpath to point to the root directory or to the jar files themselves?
Once again...thank you so much for the patience and replies
Best Regards,
YJ

HAHHAHAA!!! It finally worked!!!!
Thank you soooo much Michiel!!!
I had to type in the jars\ and it works after that

Finally...thank you so much to David and Michiel...
By the way...a last question...If I'm to run the codes in a Java editor, I'll have to import the packages and do I have to configure the compiler's setting as well or something? Such as setting the classpath to point to the root directory or to the jar files themselves?
Once again...thank you so much for the patience and replies

Best Regards,
YJ