I browsed the java开发者_JAVA技巧doc for PyInteger and found it supports api tojava. However, when I run the following script, error happens.
n=1
n.__tojava__(java.math.BigInteger)
AttributeError: 'long' object has no attribute '_tojava_'
I found only the api which is written with pure python could be called successfully. For other apis, there are always errors, saying "xxx object has no attribute 'xxx'". Is there any configuration I should do?
if all you want is a BigInteger, you an just construct an instance using the string constructor
x=java.math.BigInteger('1')
or in your case
x=java.math.BigInteger(str(n))
精彩评论