python调用Java代码
#coding:utf-8 #!/usr/bin/python from jpype import * import os.path,json from ethereum.utils import encode_hex from ethereum.tools import keys jarpath = os.path.join(os.path.abspath('.')+"\\CSDCSign\\", 'sign.jar') startJVM(getDefaultJVMPath(), "-Djava.class.path=%s" % jarpath ) JDClass = JClass("com.juzix.TestCreateAllDisPledgeApplyApi")#Java中的主函数 jd = JDClass() #jd = JPackage("jpype").JpypeDemo() #两种创建jd的方法 jprint = java.lang.System.out.println sign=jd.mySign("11111111","{\"smsType\": \"2\", \"phoneNumber\": \"18706174488\",\"smsContent\": \"csdc\", \"valiCode\": \"999999\",\"activeTime\": \"3\", \"refreshTime\": \"999999\"}") jprint(sign) shutdownJVM()