News for hackers. Stuff that matters.
Re:Pyjnius: Accessing Java classes from Python by mahmoudimus on Monday August 20, 2012 @02:09PM (#4408932)
This is pretty much a perfect example of when to leverage import hooks.
Re:Pyjnius: Accessing Java classes from Python by tocomment on Monday August 20, 2012 @02:29PM (#4409037)
Can you explain that a bit more?
Re:Pyjnius: Accessing Java classes from Python by d0mine on Monday August 20, 2012 @05:42PM (#4409937)
So that you could:

  from java.util import Stack
Instead of:

  from jnius import autoclass
  Stack = autoclass('java.util.Stack')
http://www.doughellmann.com/PyMOTW/sys/imports.html#custom-i...
Re:Pyjnius: Accessing Java classes from Python by txprog on Monday August 20, 2012 @06:16PM (#4410070)
Someone on reddit asked for it, we'll do it.
Re:Pyjnius: Accessing Java classes from Python by __mharrison__ on Monday August 20, 2012 @01:02PM (#4408544)
Interesting. It would be great to see some docs touching on pros/cons vs jython, jpype, etc

I for one am interested in keeping everything in cpython if possible. But I currently have a web service in jython...

Re:Pyjnius: Accessing Java classes from Python by tehansen on Monday August 20, 2012 @10:45AM (#4407829)
Re:Pyjnius: Accessing Java classes from Python by ikusalic on Monday August 20, 2012 @11:16AM (#4407965)
I've used JPype in the past, but unfortunately it seems pretty much dead.

This looks really promising. Thank you for the hard work.

Re:Pyjnius: Accessing Java classes from Python by jpdus on Monday August 20, 2012 @12:21PM (#4408302)
Looks good!

Has anyone tried this for accessing a Java Socket API? (e.g. Interactive Brokers API) Im currently using Jython but would love to switch to "real" Python, unfortunately i am still a noob when it comes to get these things working..

Re:Pyjnius: Accessing Java classes from Python by jaytaylor on Monday August 20, 2012 @12:42PM (#4408443)
@jpdus Will you elaborate on why you are eager to ditch Jython in favor of CPython? I guess I have a soft spot for Jython.

Overall this project looks very interesting- Can't wait to go through the source code at https://github.com/kivy/pyjnius to see how this works under the hood.

Cheers.

Re:Pyjnius: Accessing Java classes from Python by jpdus on Monday August 20, 2012 @01:37PM (#4408749)
@jaytaylor The main reason for my part is that most/all my projects are pure python so far and im way more familiar with (C)Python and its libraries (numpy/scipy fe), dependencies, etc. than i am with Java. I like Jython too, but if i had the opportunity to do everything in pure Python i would ditch it nevertheless!
Re:Pyjnius: Accessing Java classes from Python by txprog on Monday August 20, 2012 @12:51PM (#4408484)
Mostly JNI, plus using our core class to use the java.reflect and discover methods and fields (you can't do it in JNI :/)
Re:Pyjnius: Accessing Java classes from Python by jnazario on Monday August 20, 2012 @04:35PM (#4409653)
what's wrong with JCC?

http://lucene.apache.org/pylucene/jcc/index.html

i have used it a lot to generate JNI bindings for other code via a simple Makefile template (list JARs and packages, alter names and versions, and poof). it works quite often, but it does run into some wonky C++ code it can't quite figure out.

still, pretty easy. one example are some (work-private) mahout bindings.

Re:Pyjnius: Accessing Java classes from Python by 3amOpsGuy on Monday August 20, 2012 @02:58PM (#4409190)
Does this mean we now have a convenient way to speak JMX from python? That would be very handy!
Re:Pyjnius: Accessing Java classes from Python by kbd on Tuesday August 21, 2012 @12:19AM (#4411157)
How are generics handled?
Re:Pyjnius: Accessing Java classes from Python by koenigdavidmj on Monday August 20, 2012 @01:23PM (#4408675)
How does it handle the two types of exception?
Re:Pyjnius: Accessing Java classes from Python by txprog on Monday August 20, 2012 @01:34PM (#4408734)
When an exception from Java side is throw, we catch it, and raise our own JavaException python class.
Re:Pyjnius: Accessing Java classes from Python by bendemott on Monday August 20, 2012 @12:33PM (#4408377)
Very promising, thanks for the great work!