#!/usr/bin/python2.7
#coding:utf8
import sys
import jpype
import os.path
phone_num = sys.argv[1]
#jarpath = os.path.join(os.path.abspath(‘.‘), ‘build/jar‘)
jarpath = ‘/home/script/p_code/build/jar‘
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % jarpath)
Test = jpype.JClass(‘com.stephen.util.resourcedict.area.COUNTRY‘) # 取得包org.wg3i.test中的类Test
#t = Test() # 创建Test实例
a=Test.getByCode(phone_num,False) # 尝试调用类的一个方法
#t.setString("Hello, World") #给定String
#s = t.getString() # 获取String
#print ‘号码:37064720063‘
#print type(a)
b = a.toString().split(‘,‘)[4]
print b.encode(‘utf8‘)
#b = a.toArray()
jpype.shutdownJVM()
时间: 2024-10-10 22:00:57