python调用jar包

2023-01-31 03:01:32 python jar 调用
import os
from jpype import *

jarpath = os.path.join(os.path.abspath('.'), 'path/xx.jar')
startJVM(getDefaultJVMPath(), "-Djava.class.path=%s" % jarpath)
FORMatScript = JClass('com.TestMain')
t = FormatScript()url = ["Http://www.test.com/8556.htm"]
t.test(url)content = t.content
java.lang.System.out.println(content)
shutdownJVM()

相关文章