Getting started with JPype

Ian Clark iclark at
Mon Aug 13 22:45:40 CEST 2007

Disclaimer: I have never used (or even heard of) JPype before...

porter wrote:
> "Package myclass.HelloWorld is not Callable"
> from jpype import *
> startJVM(getDefaultJVMPath(), "-ea", "-Djava.class.path=D:/tmp/jpype-
> reli/test/dist/test.jar'' )
> package = JPackage("myclass")

Shouldn't this be `package = JPackage("myclasses")` as your Java code is 
contained in the package 'myclasses' not 'myclass'?

> x = package.HelloWorld()

Change this last line to: `x = package.HelloWorld`
(class would be a better name than x IMO)

> x.do_a_message()
> shutdownJVM()

It looks like JPype exports Java classes as members of the object 
referred to by `package`. You then try and call it with () and python 
throws it's hands in the air as it must not be a callable.


More information about the Python-list mailing list