Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFreeChart installation problem

 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already download the jfreechart-1.0.1 and extract to a file call jfreechart API. but i donno how to install the jfreechart to make the java compiler can recognize the library. i also already download the installation guide from the jfreechart but i don't understand what the installation guide talking about.
can someone here have this experienceteach me what to do.


thank you.



best regards,
Albert
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I donno how to install the jfreechart to make the java compiler can recognize the library


All you have to do is to put jcommon-1.0.0.jar and jfreechart-1.0.1.jar files in your classpath.

Have a look at a the demo:
java -jar jfreechart-1.0.1-demo.jar
[ February 22, 2006: Message edited by: Satou kurinosuke ]
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i already put that two jar file in the classpath but it not work. i found the error when compile my java file. i can run the demo successfully

what is the problem is???
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is your file then
What are you doing ?
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
after i extract the jfreechart, then i recompile it using ant. i set the classpath to the jfreechart-1.0.1.jar and jcommon1.0.0.jar.
but when i compile my java, it come out the error message

First.java:1: package org.jfree.data does not exist
import org.jfree.data.DefaultPieDataset;
^
First.java:2: package org.jfree.chart does not exist
import org.jfree.chart.ChartFactory;
^
First.java:3: package org.jfree.chart does not exist
import org.jfree.chart.JFreeChart;
^
First.java:4: package org.jfree.chart does not exist
import org.jfree.chart.ChartFrame;
^


what the problem is?

is it i need to download the additional thing to make the API can run?
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i solve my problem already than k for the help.
actually my problem is i set my classpath using the environment variable. but this method not use for me. then i try the second method where is send classpath by using the SET CLASSPATH command in the command prompt. this is the method which make the installation complete and i successfully compile my file and run it.so i post this for anyone that face the same problem can that this as the reference. thank you.



regards,
albert
 
Potter James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me the way to recognise the JFREECHART to my java compiler step by step.I tried the way of setting class path.It did not work.So can someone tell a clear idea..
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you adding the jar files to the classpath? The easiest way is to use the "-classpath" switch, like

(use a colon instead of a semicolon on Unix systems)
 
Potter James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.Now just tell me where to put the folder JFREECHART in the java installation directory.I have put that in bin.Also tried to zip it in "src".It is working if i put the jfree folder and my program in bin.But my aim is to run the coding in a JSP page.It is not recognizing the jfree package in "import" command.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter where the JFreeChart directory resides, but inside of the JDK installation seems a bad place, particularly the bin directory.

For web applications the jar files need to be inside of the WEB-INF/lib directory, since web apps don't use the standard classpath.
 
Potter James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have executed the code finally..Thanks a lot for your tips
 
shanaya dutt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii,im a fairly new programmer in java.I need to implement a polar graph that requires Jfreechart.but i'm having problems in the compiler recognising the jfree package.

i use command prompt and when i tried running the demo file
using java -jar jfreechart-1.0.13.jar

it throws the following errors

Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/ui/Applicat
ionFrame
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jfree.ui.ApplicationFrame
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 12 more
Could not find the main class: demo.SuperDemo. Program will exit.


and if tried compiling my application using -classpath method...it throws an invalid flag error

C:\Documents and Settings\Administrator>javac -classpath C:\Documents and Settin
gs\Administrator\jfreechart-1.0.13\lib\jfreechart-1.0.13.jar;C:\Documents and Se
ttings\Administrator\jfreechart-1.0.13\lib\jcommon-1.0.16.jar polarpanel.java
javac: invalid flag: Settings\Administrator\jfreechart-1.0.13\lib\jfreechart-1.0
.13.jar;C:\Documents
Usage: javac <options> <source files>
use -help for a list of possible options


please help me...anyone?
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Other Open Source Software
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shanaya dutt wrote:Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/ui/ApplicationFrame

You need to add the JCommon and JFreeChart Demo jar files to your classpath.

and if tried compiling my application using -classpath method...it throws an invalid flag error

If the classpath contains spaces then you need to quote it:

javac -classpath "C:\Documents and Settings\Administrator\jfreechart-1.0.13\lib\jfreechart-1.0.13.jar;C:\Documents and Settings\Administrator\jfreechart-1.0.13\lib\jcommon-1.0.16.jar" polarpanel.java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic