[Python] Invocare una classe Java

Fabrizio Reale fabrizio.reale a redomino.com
Lun 17 Nov 2008 12:55:35 CET


On Monday 17 November 2008 12:49:04 michele a nectarine.it wrote:
> Quoting "Fabrizio Reale" <fabrizio.reale a redomino.com>:
> 
> > On Thursday 13 November 2008 10:24:25 michele a nectarine.it wrote:
> >> 2008/11/10 Fabrizio Reale <fabrizio.reale a redomino.com>:
> >> > Ciao a tutti,
> >> > ho una classe Java con cui devo interagire in Python scambiandomi
> >> > tipi di oggetti semplici (stringhe e numeri).
> >> > Quale via consigliate?
> >
> >> http://wiki.python.org/moin/ScriptingJava
> >> Personalmente, ti consiglio JPype invece di JPE.
> >
> > Ti si compila sotto Linux?
> > A me sta dando problemi.
> >
> 
> Si, mi ricordo che c'era da cambiare il path della JVM in setup.py,  

Si, quell'ho fatto.

> prova a leggere il README oppure posta qui gli errori.
Ho letto tutto quel che c'era da leggere (almeno spero).
L'errore che ho in compilazione è:
building '_jpype' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/linux -Isrc/native/common/include -Isrc/native/python/include -I/usr/include/python2.4 -c src/native/common/jp_objecttypes.cpp -o build/temp.linux-i686-2.4/src/native/common/jp_objecttypes.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
In file included from src/native/common/include/jpype.h:99,
                 from src/native/common/jp_objecttypes.cpp:17:
src/native/common/include/jp_env.h: In constructor ‘JPMallocCleaner<T>::JPMallocCleaner(size_t)’:
src/native/common/include/jp_env.h:59: error: there are no arguments to ‘malloc’ that depend on a template parameter, so a declaration of ‘malloc’ must be available
src/native/common/include/jp_env.h:59: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
src/native/common/jp_objecttypes.cpp: In member function ‘virtual HostRef* JPObjectType::convertToDirectBuffer(HostRef*)’:
src/native/common/jp_objecttypes.cpp:215: warning: deprecated conversion from string constant to ‘char*’
src/native/common/jp_objecttypes.cpp: In member function ‘virtual void JPObjectType::setArrayValues(__jarray*, HostRef*)’:
src/native/common/jp_objecttypes.cpp:242: warning: deprecated conversion from string constant to ‘char*’
error: command 'gcc' failed with exit status 1


Ma spero di non dover mettere mano al codice C++.

Fabry


-- 
Fabrizio Reale - fabrizio.reale a redomino.com
Redomino S.r.l. - http://www.redomino.com/
Largo Valgioie 14 - 10146 Torino - Italy
Tel: +39 011 7499875 - Fax: +39 011 3716911 
    


Maggiori informazioni sulla lista Python