Using Smalltalk with Java: JavaConnect and JNIPort
30 April, 2008
Torsten Bergmann has an interesting post which introduces JavaConnect, a project by Johan Brichau, a postdoctoral researcher at the Université catholique de Louvain. JavaConnect is a library (developed using Visualworks Smalltalk and released under the MIT licence) that allows a seamless interaction between Smalltalk and Java. Johan describes it as allowing a Smalltalk application to “access any Java object and send messages to it, just as if it were a Smalltalk object. Its implementation relies on a connection between the Smalltalk environment and a standard Java VM environment using Visualworks’ DLLCC and Java’s JNI. The Java application thus executes on a regular Java VM and the Smalltalk application executes on the regular Smalltalk VM.”
Joachim Geidel posted a comment giving a detailed comparison of JavaConnect to JNIPort, a similar tool developed by Chris Uppal for Dolphin Smalltalk, and ported by to VisualWorks by Joachim, a consultant for blueCarat Consulting GmbH. JNIPort (available under a bespoke, liberal licence) invokes a Java VM using the Invocation Interface functions of the Java Native Interface (JNI). It can automatically generate wrapper classes for Java classes.
Joachim and Johan developed the two projects in parallel, and have discussed whether they could merge in the future, although there are a number of differences in the designs at present. In particular, Joachim believes that JNIPort as currently implemented could be more readily ported to Squeak.