I'd like to know how Perl, Python, and different their approach to integrating with Java.
I have experience combining Perl and Java through the Inline::Java module. But no experience with Python's Jython and Ruby's JRuby.
My understanding if that Inline::Java
works by using Perl code to start up a JVM and then either compiling Java code specified inline to Java bytecode or loading requested Java classes from Jars in the classpath. The programmer can then use these Java classes within Perl code, at which point, Inline::Java
transfers data between Perl space and the JVM using either network sockets or the JNI. The advantage of this approach is that Perl code runs still works in the standard Perl interpreter so it behaves normally. Furthermore, it is possible to use both Inline::Java
and C based Perl modules in the same program. The big downsides are that there's a communications overhead Perl and the JVM and the complexity of running both Perl and JVM processes.
Can anyone tell me how this approach compares with Jython or JRuby?
My understanding of Jython is that it converts Python programs to Java byte code and runs them in the JVM. The advantage of this is that it's relatively seamless to call Java libraries. The disadvantage is that C based modules such as Numpy cannot be used with Jython. Furthermore, there is a theoretic possibility that Python code will behave differently under Jython than the standard Python interpreter.
I'm less clear how JRuby works and would be interested in hearing people's experiences with it.