classpath set up question

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Lawrence Williams

classpath set up question

Post by Lawrence Williams » Thu Mar 13, 2003 10:42 pm

What should I set my environment variable "classpath" to, in order to compile the demo java programs within the jfreechart\src\com\jrefinery\chart\demo directory ??

When I downloaded and unzipped the files for jfreechart, I unzipped to directory c:\jfreechart-0.9.6

When I go to try and compile anything in the c:\jfreechart-0.9.6\src\com\jrefinery\chart\demo\ directory, I get 100's of errors and I believe it has something to do with the classpath variable.

Should I be trying to compile the .java demo files from within the \demo directory or should I be using some subdirectory command to compile it from another directory...
(Please include an example of what my command line syntax should be to compile the TimeSeriesDemo.java file) and then what would the syntax be to run the TimeSeriesDemo.class file from within the c:\jfreechart-0.9.6\src\com\jrefinery\chart\demo\ directory ?

Could someone give me a little guidance??

Thank you.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: classpath set up question

Post by david.gilbert » Fri Mar 14, 2003 1:34 pm

Hi Lawrence,

The jfreechart-0.9.6.jar and jcommon-0.7.2.jar files contain all the precompiled files you need. There is no need to recompile the .java files, but the Ant script is there if you ever want to.

You don't need to move the jar files from where they are when you unpack JFreeChart. You just need to tell Java where they are (I use the -classpath setting on the command line, see below).

The jfreechart-0.9.6-demo.jar file contains applications that *use* the JFreeChart library, and so it needs the two jar files listed in the previous paragraph. When you type:

Code: Select all

java -jar jfreechart-0.9.6-demo.jar
...the 'java' interpreter looks inside the jfreechart-0.9.6-demo.jar file to find the (relative) paths to the jfreechart-0.9.6.jar and jcommon-0.7.2.jar files...and also the name of the class to run (com.jrefinery.chart.demo.JFreeChartDemo is the default).

But you can also specify this information manually. That's the alternative command given in section 3.4 of the manual:

Code: Select all

java -classpath lib/jfreechart-0.9.6.jar:lib/jcommon-0.7.2.jar:jfreechart-0.9.6-demo.jar <name-of-class>
The <name-of-class> could be any of the 50 or so demo applications, for example:

com.jrefinery.chart.demo.AreaChartDemo

or

com.jrefinery.chart.demo.PriceVolumeDemo

Does that help?

Regards,

Dave Gilbert

Locked