参考这个大神的csdn就可以了
https://www.cnblogs.com/botoo/p/8038507.html
- 需要安装 jpype
- jvm.dll 在jre.bin目录下
- 后面就是正常的java类的操作了。注意区分非static方法先创建类实例
# coding=utf-8
from jpype import *
import jpype
jvmPath = 'C:\Program Files\Java\jre1.8.0_101\\bin\server\jvm.dll'
# jpype.startJVM(jvmPath)
jpype.startJVM(jvmPath, "-Djava.class.path=D:\\Projects\\IDEAProjects\\HaNLP\\out\\artifacts\\wy\\wy.jar")
insClass = JClass('PythonTest.PythonTest')
ins = insClass()
print(ins.test("wy", "lichenxi"))
shutdownJVM()