1 '''
 2 Created on 2016年6月1日
 3 
 4 @author: cero
 5 '''
 6 import jpype
 7 
 8 jvmPath = jpype.getDefaultJVMPath()
 9 ext_classpath = '/home/cero/temp/chinapnr.jar'
10 jvmArg = '-Djava.class.path=' + ext_classpath
11 if not jpype.isJVMStarted():
12     jpype.startJVM(jvmPath, jvmArg)
13     system = jpype.java.lang.System
14     system.out.println('hello world!')
15     system.out.println(system.getProperty("user.dir"))
16     SecureLink = jpype.JClass('chinapnr.SecureLink')
17     sl = SecureLink()
18     ret = sl.EncMsg("/home/cero/temp/PgPubk.key", 'aaaa')
19     EncMsg = sl.getEncMsg()
20     print(ret)
21     print(EncMsg)
22     jpype.shutdownJVM()

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

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

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2021-06-27
  • 2021-08-07
  • 2021-12-25
  • 2021-12-24
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-05-17
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案