JNIPort: Running Java from Squeak
11 June, 2010
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.
11 June, 2010 at 17:58
Thanks for spreading the word! But please note that JNI stands for “Java Native Interface” which is an interface offered by the Java Virtual Machine. Chris Uppal did not implement JNI. He implemented JNIPort, which uses the JNI and which I have ported to VisualWorks. I usually write “JNIPort for VisualWorks” when I mean the version for VisualWorks.
12 June, 2010 at 13:54
Thanks Joachim, I’ve now corrected the article.