开发者

AttributeError: 'long' object has no attribute '__tojava__'

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))

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜