Moving on...
In the factory class, I need to pass a Java class as parameter to the Python
class constructor. In the example:
{code}PyObject employeeObj = jyEmployeeClass.__call__(new
PyString(first), new PyString(last), new PyString(id));{code}
... I need to pass a Java class instead of Python strings, something like:
{code}PyObject employeeObj = jyEmployeeClass.__call__(new
<???>(AJavaClass));{code}
I tried PyJavaClass but it doesn't seem to work (can't find symbol).
Please help. TIA.
On Thu, Nov 20, 2008 at 5:17 PM, Vincent Gulinao
<vincent.gulinao@...:
> I figured it out, set python.path property.
>
>
> On Thu, Nov 20, 2008 at 3:59 PM, Vincent Gulinao <
> vincent.gulinao@...> wrote:
>
>> Looks like PythonInterpreter in the factory class is calling standard
>> Python interpreter, not Jython.
>>
>> How do I make PythonInterpreter point to Jython instead then?
>>
>>
>> On Wed, Nov 19, 2008 at 7:30 PM, Vincent Gulinao <
>> vincent.gulinao@...> wrote:
>>
>>> Hi Charlie,
>>>
>>> I find your object factory solution very interesting. I tried it but I
>>> get the ff. error:
>>>
>>> Exception in thread "main" Traceback (innermost last):
>>> File "<string>", line 1, in ?
>>> ImportError: no module named Employee
>>>
>>> I tested inside Jython CLI it can properly import EmployeeType.
>>>
>>> What did I miss?
>>>
>>> On Sat, Nov 15, 2008 at 1:40 AM, Charlie Groves <
>>> charlie.groves@...> wrote:
>>>
>>>> On Tue, Nov 11, 2008 at 8:29 PM, Vincent Gulinao
>>>> <vincent.gulinao@...> wrote:
>>>> > For example, I need to extend a class from java, implement my end of
>>>> the
>>>> > code, jythonc it, which will then be called by the framework.
>>>>
>>>> Do you need to jythonc it? You can extend Java classes without
>>>> jythonc, and you can instantiate Python classes from Java without
>>>> jythonc. I ask because jythonc is going away in 2.5, so it's not a
>>>> good long term solution.
>>>>
>>>> > In particular, how do you tell Jython where to find the class you want
>>>> to
>>>> > derive? (thus, the --classpath equivalent). How do you integrate the
>>>> output
>>>> > of jythonc back to the framework?
>>>>
>>>> Jython finds code through the classpath, so if you have jython and
>>>> your classes in your JVM, you can import your classes from Python and
>>>> make subclasses of them. The same goes in reverse. The framework
>>>> needs to be on the classpath at the same time, and you can use a
>>>> technique along the lines of
>>>> http://wiki.python.org/jython/JythonMonthly/Articles/October2006/3 to
>>>> get your classes into it.
>>>>
>>>> Charlie
>>>>
>>>
>>>
>>
>
|