473,734 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Integration with java

Hello,

I am working on a project in Python, and I"m
currently
looking into the possibiliy of writing some of the
project"s modules in Java. Given that a large part of
the code is already written in Python, using the
standard libraries and several extension modules, I
am
trying to gauge the viability of integration with
Java
via Jython with minimal impact on present code, on
the
complexity of future code, and on deadlines!

I need to know in general how dirty it will be to
combine the two languages, and what the costs I
should
take into account are. I"m also interested to know if
there are any commonly accepted strategies to fully
switch project languages (I"m considering, in the
extreme case, to change it all into Java), and if
writing some modules in Java and replacing the rest
gradually makes sense.

Three more specific questions I thought of:
1. Is is possible to pack a Jython/Java program in a
py2exe-like fashion? Is it possible to pack in such a
way both Python, Jython and Java code?
2. Does transferring large data structures between
Java and Python code running by Jython have a
significant effect on memory? For example, would
passing the result of a large database query from
Java
to Jython, for further processing, cause the entire
data to be duplicated or something similar?
3. Did I miss anything fundemental?

Thanks!

Joe.
_______________ _______________ _______________ _____
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 18 '05 #1
14 2880
Joachim Boomberschloss wrote:
the code is already written in Python, using the
standard libraries and several extension modules


One thing to keep in mind is that Jython does not
integrate CPython, instead it "understand s" python code
directly. So if you have a C extension that works with python
it won't work with Jython.

My feeling is that if you had a lot of Java code written and
wanted to build on that with python Jython would be a better
fit than vice versa.

Istvan.
Jul 18 '05 #2
It is possible, though possibly painful, to call java modules from
CPython using JNI. This is more difficult than Jython integration, but
probably required if you want to keep using your extension modules.

The JNI tutorial is available at
http://java.sun.com/docs/books/tutor...1.1/index.html .

I probably would not take this approach unless java offered some
incredibly substantial benefit or I was integrating a complex python
system with a complex java sytem. I would also probably start by
creating a good C API to access the required java modules via JNI and
then use SWIG (http://www.swig.org/) to generate the python wrapper.

Of course if you can drop the extension modules you have already
written, accessing Java from Jython is just an import statement away.
Good luck,

Chris

Jul 18 '05 #3
How about this?
http://jpype.sourceforge.net/

(I haven't used it myself)

Jul 18 '05 #4
In article <sP************ ********@gigane ws.com>,
Istvan Albert <ia*****@mailbl ocks.com> wrote:
Joachim Boomberschloss wrote:
the code is already written in Python, using the
standard libraries and several extension modules


One thing to keep in mind is that Jython does not
integrate CPython, instead it "understand s" python code
directly. So if you have a C extension that works with python
it won't work with Jython.

My feeling is that if you had a lot of Java code written and
wanted to build on that with python Jython would be a better
fit than vice versa.

Istvan.


There are other possibilities, though, including JPE
<URL: http://jpe.sourceforge.net >. I recommend the
original poster consider the latter.
Jul 18 '05 #5
Can someone summarize in a nutshell what is the
difference between JPype and JPE?
Jul 18 '05 #6
In article <34************ *@individual.ne t>,
Jon Perez <jb********@wah oo.com> wrote:
Can someone summarize in a nutshell what is the
difference between JPype and JPE?


JPE's the original. It provided more functionality than JPype has
achieved so far, I believe (though that could change any day). I
think no one now maintains JPE.

Someone really ought to include a couple of sentences to that effect
on the front page of <URL: http://jpype.sf.net/ >.
Jul 18 '05 #7
Cameron Laird wrote:
In article <34************ *@individual.ne t>,
Jon Perez <jb********@wah oo.com> wrote:
Can someone summarize in a nutshell what is the
difference between JPype and JPE?

JPE's the original. It provided more functionality than JPype has
achieved so far, I believe (though that could change any day). I
think no one now maintains JPE.

Someone really ought to include a couple of sentences to that effect
on the front page of <URL: http://jpype.sf.net/ >.


Well, Cameron summed it up pretty good :)

I'd add that The only major (and yes I know it is VERY major)
funtionailty missing in JPype is the ability to subclass Java classes in
Python.

On the other hand JPype will (soon) have functionality that JPE doesnt
have. Java arrays can already (in 0.4) be iterated as regular Python
collections. Version 0.5 will add that same behavior for Java
collections (Map, List, Set, Iterator).

Of course, the above is based on the JPE documentation, because I havent
been able to get JPE to work.

About Cameron's suggestion, sure. I'll do it as soon as I (or someone
else) can get both JPype and JPE to work so they can be compared through
more than just their respective documentation.

Steve
a.k.a devilwolf on sourceforge
Jul 18 '05 #8
Cameron Laird wrote:
Someone really ought to include a couple of sentences to that effect
on the front page of <URL: http://jpype.sf.net/ >.


Now I remember visiting this site, but never understood how it
actually worked. Examples such as:

from jpype import *
startJVM("d:/tools/j2sdk/jre/bin/client/jvm.dll", "-ea")
java.lang.Syste m.out.println(" hello world")
shutdownJVM()

in three different versions are the only code examples
that to show "complete" working snippets. I'm still
clueless as to how would one say share a list between
python and java.

Istvan.
Jul 18 '05 #9
Istvan Albert wrote:
Now I remember visiting this site, but never understood how it
actually worked. Examples such as:

from jpype import *
startJVM("d:/tools/j2sdk/jre/bin/client/jvm.dll", "-ea")
java.lang.Syste m.out.println(" hello world")
shutdownJVM()

in three different versions are the only code examples
that to show "complete" working snippets. I'm still
clueless as to how would one say share a list between
python and java.


A while ago there was a thread in c.l.p about using JPype to access JMS
from within Python. IIRC someone then contributed a more elaborate real
life example of how to do this. Search Google Groups for more details.

Regards,
Jan
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3595
by: Dan | last post by:
Hello all. I am currently working on a project for several Hospitals. The application is written in Java, and the database is either Oracle or MySql, depending on the client. For a while now, we have been asked to integrate our appliations database with the databases of the other Hospital applicatoins, such as payroll, scheduling and so on. I have been looking around online to see how others have done this, and I have come up with...
0
2305
by: Stylus Studio | last post by:
DataDirect XQuery(TM) is the First Embeddable Component for XQuery That is Modeled after the XQuery API for Java(TM) (XQJ) BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies (http://www.datadirect.com), the software industry leader in standards-based components for connecting applications to data and an operating unit of Progress Software Corporation, today announced the release of DataDirect XQuery(TM), the first embeddable...
0
2794
by: John | last post by:
We are doing integration with an AS400 running websphere - webservices. When the customer (AS400) calls the .Net webservice the customers java code (every other request or so) throws the following exception. We are both researching the possible cause of this. Any suggestions on the .Net side for resolving this would be helpful. John java.io.IOException: Broken pipe. at java.lang.Throwable.<init>(Throwable.java:195)
0
2562
by: Rithish | last post by:
OS : RHEL3 PHP version : 5.0.2 JDK version : 1.5.0.06 I have been trying to compile PHP with JAVA support for the past week, and all I have left to do is take a noose and hang myself. Of all the articles, tutorials, posts that I have seen and browsed ( none of them on PHP5+ though ), all of them speak of a libphp_java.so/java.so file being created. However, no such file is being created. I have tried almost all the tips and tricks that...
8
4219
by: Dave Potts | last post by:
Hi, I'm just starting a development project in Python having spent time in the Java world. I was wondering what tool advice you could give me about setting up a continuous integration environment for the python code: get the latest source, run all the tests, package up, produce the docs, tag the code repository. I'm used to things like Maven and CruiseControl in the Java world. Cheers,
1
2411
by: YellowfinTeam | last post by:
Marketplace: Yellowfin reporting 3.1 with BIRT Integration Yellowfin is proud to announce the release of 3.1. The major theme of this release is enhanced integration capability. We have introduced a range of new web services and authentication processes that allows for Yellowfin to be integrated into any environment with ease. These changes include: * Single signon capability
3
4955
by: stien | last post by:
Hi, I'm looking for someon who can help me with a problem with the php/java integration...It just won't work.. Here are some data to describe the software/system I'm working with: OperatingSystem: Windows Xp Webserver: Apache 2.2.3 PHP: PHP5.2 Java: j2sdk1.4.2_12
3
3616
by: 2b|!2b==? | last post by:
Die-hard C++ enthusiast hear (only been recently converted - actually dragged kicking and screaming to ASP.net). I have loads of C++ libraries - what is the technology/methodolgy that provides the tightest integration of C++ and the .Net languages (C# especially - since that is my target language) BTW, preference is given to methodologies/technologies that involve the least learning curve (from a seasoned C++ programmers point of view).
5
3317
by: Hussein B | last post by:
Hi. Please correct my if I'm wrong but it seems to me that the major continuous integration servers (Hudson, CruiseControl, TeamCity ..) don't support Python based application. It seems they mainly support Java, .NET and Ruby. Can I use one of the previous listed servers for Python project? Thanks.
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.