ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Getting started with JPype
by Ian Clark other posts by this author
Aug 13 2007 3:56PM messages near this date
Getting started with JPype | Re: Getting started with JPype
Disclaimer: I have never used (or even heard of) JPype before...

porter wrote:
(snip)
>  
>  "Package myclass.HelloWorld is not Callable"
>  
(snip)
>  
>  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.

Ian

-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Porter
Ian Clark
Porter

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved