我以正确的方式安装了 JPype,一切都很好,我的安装成功但是当我从命令提示符运行我的 refactor.py 时,我在标题中指出了错误。我希望你能帮助我解决这个问题。我还必须指出我是 python3 的初学者。
这是我的代码:
import urllib.request
import os
import tempfile
import sys
import fileinput
import logging
import jpype
logging.basicConfig(filename="ERROR.txt", level= logging.ERROR)
try:
logging.debug('we are in the main try loop')
jpype.startJVM("C:/Users/user/AppData/Local/Programs/Python/Python36/ClassWithTest.java", "-ea")
test_class = jpype.JClass("ClassWithTest")
a = testAll()
file_java_class = open("OUTPUT.txt", "w")
file_java_class.write(a)
except Exception as e1:
logging.error(str(e1))
jpype.shutdownJVM()