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
Getting started with JPype
by Porter other posts by this author
Aug 13 2007 9:09AM messages near this date
Re: Help with optimisation | Re: Getting started with JPype
Hi,

For nefarious javaesque reasons I've been trying to get started with
jpype (http://jpype.sourceforge.net). This looks like a potentially
useful tool for integrating java classes into C-python, but
frustratingly I've run into immediate problems. The documentation on
the project really doesn't deal with 'the basics' and I believe it is
this that I am running foul of: I have read much on the web, and I
suspect that this is a classpath issue, but I can't see what I'm doing
wrong.

And I'm confident that the path I specify is ok

The error I get is

"Package myclass.HelloWorld is not Callable"

but I suspect that this is, infact, telling me that the class
HelloWorld could not be found.

If so - why not? - Note that using java

Here's my python code snippet

from jpype import *

startJVM(getDefaultJVMPath(), "-ea", "-Djava.class.path=D:/tmp/jpype-
reli/test/dist/test.jar'' )

package = JPackage("myclass")
x = package.HelloWorld()
x.do_a_message()

shutdownJVM()

I have a java class called HelloWorld in package "myclass" which
resides in test.jar. The source is below:

package myclasses;

public class HelloWorld
{

    /** Creates a new instance of HelloWorld */
    public HelloWorld()
    {
    }

    public void message()
    {
        System.out.println("Hello, World");
    }

    public static void do_a_message()
    {
        System.out.println("Static Hello, World");
    }
}

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