[squeak-dev] JNIPort preview for Squeak and Pharo available on SqueakSource

Joachim Geidel joachim.geidel at onlinehome.de
Tue Jun 8 19:01:08 UTC 2010

I have made a preview release of JNIPort for Pharo/Squeak available on

JNIPort is 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.

If you want to know what can be done with JNIPort, see
for an example.

Installation instructions are on the Wiki at SqueakSource. See
http://jniport.wikispaces.com/ for more information about JNIPort.

The current state of the Pharo/Squeak version of JNIPort (as of June 8,

* Starting a JVM seems to lead to a deadlock in Squeak 4.1, but not in
Pharo. When you start a JVM, nothing happens until you hit command-. (on a
Mac), wait until a notifier for the user interrupt appears, and proceed. The
problem seems to be somewhere in WeakRegistry; it disappears when you
replace Squeak¹s WeakRegistry by the WeakRegistry class from a Pharo image.
* The UTF16TextConverter in Squeak 4.1 has a bug. I found the same problem
in Pharo and reported it there, a patch is already in the queue for Pharo. I
have no idea if this will automatically make it into Squeak. See
>> http://code.google.com/p/pharo/issues/detail?id=2516
> This means that java.lang.String objects will probably result in junk when
> they are converted to Smalltalk Strings in Squeak 4.1.

* Callbacks from Java to Smalltalk are not yet supported.
* In contrast to VisualWorks and Dolphin, JNIPort does not create ghost
classes as wrappers for Java classes, but creates ³real² classes which can
be seen in the system browser. It also does not copy prototypes of
CompiledMethods when a wrapper class or a Java class is created, because
this causes VM failures in Pharo 1.0. Instead, methods are compiled from
source code. This has a performance impact, of course.
* Another difference from the VisualWorks and Dolphin versions is that
wrappers for Java methods without arguments don¹t have selectors ending with
an awkward ³_null² suffix.
* JNIPort has been developed and tested with Pharo 1.0 on Mac OS X 10.6.3.
If it works on other operating systems has yet to be tested.
* I don¹t have a Metacello configuration yet.

The next steps will be:
* Adding support for callbacks from Java to Smalltalk.
* Testing it on more platforms.
* Reorganization of the documentation on the JNIPort wiki, and addition of
Pharo/Squeak specific documentation similar to the documentation for the
VisualWorks version.
* Release of JNIPort 2.0 for VisualWorks and Pharo/Squeak when everything is
stable. This will be after the release of Pharo 1.1.

If it works in Squeak 4.1 or on Linux or Windows, please let me know,
especially if you had to do something which might be worth mentioning in the
installation instructions.

Have fun with JNIPort, and let me know if it works!

Joachim Geidel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100608/7b492f01/attachment.htm

More information about the Squeak-dev mailing list