1

我的 PC (Windows) 上安装了 python 2.7,我需要 jpype 才能使用 .jar 库中的一些 Java 类方法。

所以我安装JPype-0.5.4.2.win32-py2.7.exe了我在项目的SourceForge 上找到的那个。

安装后,我尝试了这段代码:

from jpype import *

print("Debug 1")
startJVM("C:/Program Files/Java/jre6/bin/client/jvm.dll", "-ea")
print("Debug 2")
java.lang.System.out.println("JPYPE WORKS !")
print("Debug 3")
shutdownJVM()
print("Debug 4")

但是当我运行它时,它只输出我的Debug x台词......

当我尝试在PyScripter上运行它时,我仍然有相同的输出,但是它显示了 2 条错误消息弹出:

Error in getting the namespace of globals

Remote Server is not connected. Please reinitialize or disconnect the remote interpreter.

就这样。我不明白为什么它不起作用。即使没有这java.lang.System.out.println条线,我也会弹出相同的错误消息。

也许是jvm.dll文件的权限问题,因为它是我的专业 PC,但我无法判断。

4

0 回答 0