wood burning stoves 2.0*
The moose likes Applets and the fly likes JApplet + JfreeChart for Line Chart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "JApplet + JfreeChart for Line Chart" Watch "JApplet + JfreeChart for Line Chart" New topic
Author

JApplet + JfreeChart for Line Chart

Varsha Pardeshi
Ranch Hand

Joined: Feb 27, 2006
Posts: 30
Hello everyone,
I have drawn Linechart in the ApplicationFrame using jfree.chart package, but when doing the same thing in the JApplet giving the following error:

c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
java.lang.NoClassDefFoundError: org/jfree/chart/ChartPanel
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Can anyone help me regarding this ?
Thanks in advance.

Regards,
Varsha Pardeshi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
It looks like the JFreeChart library is missing from your applet classpath. What does the applet tag look like, and where do you keep the applet and JFreeChart classes?


Ping & DNS - my free Android networking tools app
Varsha Pardeshi
Ranch Hand

Joined: Feb 27, 2006
Posts: 30
Originally posted by Ulf Dittmer:
It looks like the JFreeChart library is missing from your applet classpath. What does the applet tag look like, and where do you keep the applet and JFreeChart classes?


Hello Ulf,
Thanks for reply. My structure is like this:
Source_Code : contains all the JSP & HTML pages
Source_Code/applet : applet java & class file
JfreeChart: c:/JfreeChart/lib/*.jar files

I have included the path of Jfreechart's jar file in the classpath environmental variable.

If I extending the myclass from ApplicationFrame the program is running absolutely fine. But if I am extending the class using JApplet I am getting the error which I have already mentioned.

can u please suggest me what setting has to be done to get these classes avaible for applet?

Regards,
varsha
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
The normal classpath is not used for applets - you need to include all jar files in the "archive" attribute of the applet. You can find etails about that here.
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
Do you really need to use Applets? As there is a JSP Tag library called CeWolf which is based upon JFreeChart which enables you to create charts in your JSP pages.


http://cewolf.sourceforge.net/new/index.html

Jason
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Jason Moors, you got the point in your saying.


My blood is tested +ve for Java.
 
wood burning stoves
 
subject: JApplet + JfreeChart for Line Chart