python调用java
def test(arg1,arg2,arg3): import os import jpype jvm_path = jpype.getDefaultJVMPath() class_path = os.path.join(settings.MEDIA_ROOT,"java_class") jvm_arg = "-Djava.class.path=%s" %class_path if not jpype.isJVMStarted(): jpype.startJVM(jvm_path, jvm_arg) if not jpype.isThreadAttachedToJVM(): #特别重要 jpype.attachThreadToJVM() #特别重要 ret = jpype.JPackage("test").TestKlass.get_v( arg1,arg2,arg3 ) return ret