Skip to content

Error on import javafx control #38

@f-lima

Description

@f-lima

Copy the code below to test.py and run it

from javafx.scene.control import TabPane
print("Ok")

It returns an error saying:

java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalStateException: Toolkit not initialized

Complete Error report:

Traceback (most recent call last):
File "test.py", line 1, in <module>
    from javafx.scene.control import TabPane
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.python.core.Py.loadAndInitClass(Py.java:991)
at org.python.core.Py.findClassInternal(Py.java:926)
at org.python.core.Py.findClassEx(Py.java:977)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133)
at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:33)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122)
at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:134)
at org.python.core.PyObject.__findattr__(PyObject.java:946)
at org.python.core.imp.importFromAs(imp.java:1160)
at org.python.core.imp.importFrom(imp.java:1132)
at org.python.pycode._pyx0.f$0(test.py:3)
at org.python.pycode._pyx0.call_function(test.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1386)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:296)
at org.python.util.jython.run(jython.java:362)
at org.python.util.jython.main(jython.java:142)
Caused by: java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:273)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(PlatformImpl.java:550)
at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(PlatformImpl.java:512)
at javafx.scene.control.Control.<clinit>(Control.java:87)
... 20 more

java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

Something is happening at import command that is generating this error.
As you can see at code, I am just importing but not using the imported class.

Added: I just noticed that the same error occurs when I try import Control directly.
Appears that the error are in creation of this class and classes that have Control as parent class, for any reason. By the other side, try to import classes that have Pane as parent works, even having Pane Control as his parent class. I don't know if this information helps.

Thanks for your help.

Jython version: 2.7.0

If this Issue was at wrong project please let me know where to put it. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions