'''
Created on 2016年6月1日 @author: cero
'''
import jpype jvmPath = jpype.getDefaultJVMPath()
ext_classpath = '/home/cero/temp/chinapnr.jar'
jvmArg = '-Djava.class.path=' + ext_classpath
if not jpype.isJVMStarted():
jpype.startJVM(jvmPath, jvmArg)
system = jpype.java.lang.System
system.out.println('hello world!')
system.out.println(system.getProperty("user.dir"))
SecureLink = jpype.JClass('chinapnr.SecureLink')
sl = SecureLink()
ret = sl.EncMsg("/home/cero/temp/PgPubk.key", 'aaaa')
EncMsg = sl.getEncMsg()
print(ret)
print(EncMsg)
jpype.shutdownJVM()

开始一直无法导入第三方包,提示class not found;

使用jar包的完整路径后成功导入。

04-30 03:01