Joachim  Geidel has published a preview release of JNIPort, a Smalltalk library which allows Java code to be invoked from Smalltalk. It acts as a bridge between the world of Smalltalk objects and a Java Virtual Machine (JVM) where Java code is executing.

The port to Pharo and Squeak is not yet finished: it lacks support for callbacks from Java to Smalltalk, and is a work in progress. Joachim is particularly interested in feedback from Squeak 4.1 users.

JNIPort was originally written by Chris Uppal for Dolphin Smalltalk and published under a liberal licence which permits its use in commercial and non-commercial software. Joachim Geidel originally ported JNIPort to VisualWorks in 2006 and is now building on that work to make it available to Pharo and Squeak. The goal is to publish a stable release for VisualWorks, Pharo and Squeak in Q3/2010.

In addition to giving Smalltalk programs access to Java libraries and services, the interactivity of Smalltalk makes it an ideal environment to experiment and prototype new Java functionality.

Once it’s installed, calling some Java can be as simple as three lines in your workspace:

jvm := JVM current.
class := jvm findClass: #’java.lang.System’.
class currentTimeMillis_null

Installation instructions documentation and much more information are on the JNIPort Wiki.