jython给出了一个错误,但是jython-version可以工作

hm2xizp9  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(250)

我的代码:

from javax.swing import JFrame

frame = JFrame("Hello")
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
frame.setLocation(100,100)
frame.setSize(300,200)
frame.setVisible(True)

但是我不能在cmd中打开jython,因为它给出了这个错误,idk为什么。当我用jython(eclipse)在java中做同样的事情时,它正在工作。

C:\>jython banana.py
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.python.core.PySystemState.<clinit>(PySystemState.java:73)
        at org.python.util.jython.main(jython.java:533)
Caused by: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
        at org.python.core.PyString.<init>(PyString.java:57)
        at org.python.core.PyString.<init>(PyString.java:70)
        at org.python.core.PyString.<init>(PyString.java:74)
        at org.python.core.Py.newString(Py.java:643)
        at org.python.core.PyJavaType.init(PyJavaType.java:543)
        at org.python.core.PyType$Registry.createType(PyType.java:477)
        at org.python.core.PyType$Registry.addFromClass(PyType.java:426)
        at org.python.core.PyType$Registry.resolveType(PyType.java:352)
        at org.python.core.PyType$Registry$1.computeValue(PyType.java:208)
        at org.python.core.PyType$Registry$1.computeValue(PyType.java:202)
        at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:226)
        at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:208)
        at java.base/java.lang.ClassValue.get(ClassValue.java:114)
        at org.python.core.PyType.fromClass(PyType.java:2137)
        at org.python.core.PyObject.<init>(PyObject.java:85)
        at org.python.core.PySingleton.<init>(PySingleton.java:9)
        at org.python.core.PyNotImplemented.<init>(PyNotImplemented.java:10)
        at org.python.core.Py.<clinit>(Py.java:66)
        ... 2 more

但是 jython --version 工作正常,jython给出了相同的错误输出。我卡住了

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题