logo       

JFreeChart in jython AttributeError: no attribute 'JFreeChart: msg#00032

lang.jython.user

Subject: JFreeChart in jython AttributeError: no attribute 'JFreeChart


I'm trying to use the JFreeChart library through jython. Right now I'm
trying to run the first example from
http://net.pku.edu.cn/~shenjian/documents/Java/jfreechart_tutorial.pdf
from jython.

My problem is that I can't seem to get a hold of the JFreeChart class:

Jython 2.1 on java1.4.2-03 (JIT: null)
Type "copyright", "credits" or "license" for more information.
> > import os, sys
> > sys.packageManager.addJarDir(os.getcwd()+os.sep+"lib"+os.sep,1)
*sys-package-mgr*: processing modified jar,
'/home/lekang/test/lib/jcommon-1.0.0.jar'
*sys-package-mgr*: processing modified jar,
'/home/lekang/test/lib/jcommon-xml-1.0.0.jar'
*sys-package-mgr*: processing modified jar,
'/home/lekang/test/lib/jcommon-xml.jar'
*sys-package-mgr*: processing modified jar,
'/home/lekang/test/lib/jfreechart-1.0.1.jar'
> > from org.jfree import chart
> > dir(chart)
['ChartColor', 'ChartFactory', 'ChartFrame', 'ChartMouseEvent',
'ChartMouseListener', 'ChartPanel', 'ChartRenderingInfo', 'ChartUtilities',
'ClipPath', 'DrawableLegendItem', 'Effect3D', 'JFreeChart',
'JFreeChartInfo', 'LegendItem', 'LegendItemCollection', 'LegendItemSource',
'LegendRenderingOrder', 'PolarChartPanel', '__name__', 'annotations',
'axis', 'block', 'demo', 'editor', 'encoders', 'entity', 'event',
'imagemap', 'labels', 'needle', 'plot', 'renderer', 'resources', 'servlet',
'title', 'urls']
> > from org.jfree.chart import JFreeChart
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: cannot import name JFreeChart
> > dir (chart.JFreeChart)
Traceback (innermost last):
File "<console>", line 1, in ?
AttributeError: java package 'org.jfree.chart' has no attribute 'JFreeChart'


Or alternatively:

from org.jfree.chart import *
dir()
['ChartColor', 'ChartFactory', 'ChartFrame', 'ChartMouseEvent', 'ChartMouseListener', 'ChartPanel', 'ChartRenderingInfo', 'ChartUtilities', 'ClipPath', 'DrawableLegendItem', 'Effect3D', 'JFreeChart', 'JFreeChartInfo', 'LegendItem', 'LegendItemCollection', 'LegendItemSource', 'LegendRenderingOrder', 'PolarChartPanel', '__doc__', '__name__', 'annotations', 'axis', 'block', 'demo', 'editor', 'encoders', 'entity', 'event', 'imagemap', 'labels', 'needle', 'os', 'plot', 'renderer', 'resources', 'servlet', 'sys', 'title', 'urls']
dir(JFreeChart)
Traceback (innermost last):
File "<console>", line 1, in ?
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.python.core.PyJavaClass.init__class__(PyJavaClass.java:155)
at org.python.core.PyJavaClass.init(PyJavaClass.java:213)
at org.python.core.PyJavaClass.initLazy(PyJavaClass.java:89)
at org.python.core.PyJavaClass.initialize(PyJavaClass.java:105)
at org.python.core.PyJavaClass.__tojava__(PyJavaClass.java:860)
at org.python.core.ReflectedArgs.matches(ReflectedArgs.java:111)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:131)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:168)
at org.python.core.PyObject.__call__(PyObject.java:270)
at org.python.pycode._pyx5.f$0(<console>:1)
at org.python.pycode._pyx5.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java:208)
at org.python.core.PyCode.call(PyCode.java:14)
at org.python.core.Py.runCode(Py.java:1135)
at org.python.core.Py.exec(Py.java:1157)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:148)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:44)
at org.python.util.InteractiveConsole.push(InteractiveConsole.java:83)
at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:62)
at org.python.util.jython.main(jython.java:199)

java.lang.NullPointerException: java.lang.NullPointerException


regards.

--
Øystein Lekang
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise