Hmm, that sucks pretty bad as it defeats the whole purpose of using Jython here :-).  Can you explain what you mean by a 'simple' object? The stage variable id of type 'Stage' and my understanding is than the JVM keeps track of the type for you. Also there is only one abstract method called start in the Java class, so I don't think is an overriding issue with Jython.

From: Pierre Thibault <>
Sent: Monday, October 10, 2011 11:02 AM
Subject: Re: [Jython-users] Anybody playing with JavaFX + Jython

2011/10/9 Jose Vicente Nunez Zuleta <>
Hello to all,

Playin with JavaFX + Jython and tried to convert the code that appears on the following location:

So far the original Java code works well but the following Jython script:

#!/usr/bin/env jython
import sys
from javafx.application import Application
from javafx.collections import FXCollections
from javafx.collections import ObservableList
from javafx.scene import Scene
from javafx.stage import Stage
from javafx.scene.chart import PieChart
from javafx.scene import Group

class PieChartSample(Application):

    def __init__(self):

    def start(self, stage):
        scene = Scene(Group())
        stage.setTitle("Imported Fruits")

        pieChartData = FXCollections.observableArrayList(
                PieChart.Data("Grapefruit", 13),
                PieChart.Data("Oranges", 25),
                PieChart.Data("Plums", 10),
                PieChart.Data("Pears", 22),
                PieChart.Data("Apples", 30))
        chart = PieChart(pieChartData)
        chart.setTitle("Imported Fruits")


if __name__ == "__main__":

Gives me the following exception:

 ./ *sys-package-mgr*: can't create package cache dir, '/Users/Shared/jython2.5.2/cachedir/packages'
Traceback (most recent call last):
  File "./", line 36, in <module>
    at javafx.application.Application.launch(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

java.lang.RuntimeException: java.lang.RuntimeException: Error: class sun.reflect.NativeMethodAccessorImpl is not a subclass of javafx.application.Application

Does anybody had a similar issue while trying to create JavaFX applications using Jython? Somehow Jython doesn't think I overrode the start method on my class.


Hello José,

I think "stage" parameter in the "start" method is a simple object. We can verify this assumption by using Java reflexion. If it is the case I believe you'll have to create a Java class to wrap PieChartSample. I don't know how to specify the type of a method parameter in Jython. I don't know if it is possible.
Pierre Thibault

Python Developer/Développeur Python
Montréal, QC

All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
Jython-users mailing list