2018년 7월 9일 월요일

[Python] Python 에서 java 호출

pip install JPype1

#!/usr/bin/env python# -*- coding:utf-8 -*-
import jpype

if __name__ == '__main__':
    classpath = './jar/whoareyou.jar'    jpype.startJVM(jpype.getDefaultJVMPath(), '-ea', "-Djava.class.path=%s" % classpath)
    WhoAreYou = jpype.JClass("kr.co.demo.WhoAreYou")

    obj = WhoAreYou()
    ret = obj.whatyourname('hello')
    print ret

    WhoAreYou2 = jpype.JPackage("kr").co.demo.WhoAreYou
    obj2 = WhoAreYou()
    ret = obj.whatyourname('world')
    print ret
    jpype.shutdownJVM()

[python] subprocess

proc.py import asyncio from argparse import ArgumentParser from asyncio import sleep async def process_function(user, file_path):     if use...