>I have written two classes, namely XMLElement and XMLTextElement in a
>file named XMLElement.py. I load this file using a PythonInterpreter in
>my main static method of my main class.
>Another class (XMLDocument) makes use of reflection using the
>Class.forName("XMLElement.XMLElement") to get the class I declared in
>Python. The problem is that the class is not found.
>So I looked in the FAQ and have not seen any answer, so here are the
>possibilties I can think of:
> - Python does not define classes that are usable from the running JVM
A pure python class (a class without any java classes/interfaces as base
class) does not exists in the form of a java class. If your python class
have a java class/interface as base class, you can call and use the
methods defined in the java base (and possible overriden in the python
class). A pure python class can instead be accessed and used with the
Try something like:
// get hold of the class
PyObject XMLElementClass = interp.get("XMLElement");
// Create an instance of XMLElement
PyObject XMLElement = XMLElementClass.__call__();
// Invoke the foobar method with two args.
new PyInteger(42), new PyString("Hello world"));