[kepler-dev] JNI under Windows

Christopher Brooks cxh at eecs.berkeley.edu
Sat Jun 10 21:10:41 PDT 2006


Ok, I got around to trying the Java Launcher for JNI
programs that was described in
http://elliotth.blogspot.com/2005/08/porting-jni-code-to-win32-with-cygwin.html
I downloaded some C code from
http://software.jessies.org/terminator/
checked it in to ptII/jni/launcher and after a little cleaning, I
was able to run the meaningOfLife demo under Windows.

The launcher program is a C program that invokes
Java that then allows Java to invoke JNI programs
under Cygwin.  Without this launcher program, under Windows
with Cygwin, any Ptolemy model that uses the JNI actors or
the Ptolemy Matlab actor exits violently.

The launcher program takes an argument that names the 
class with a slash separated name.  Also, thee class path
must be passed in as a property.
For example, to run "vergil -jni", we do:
$PTII/jni/launcher/launcher -Djava.class.path="$PTII" ptolemy/vergil/VergilApplication -jni

The launcher can be used to solve the problems we were
having with Viptos under Windows.
Also, it should help with the Matlab interface.

One side effect is that since we now need a custom launcher for the
Matlab actor, the InstallAnywhere LaunchAnywhere binary is probably
not going to cut it for us. This means will need a new installer.  If
we don't need the Matlab actor, then InstallAnywhere can still be
used.

Interestingly, Kepler uses JNI in a few places, most notably with R.
I'm surprised that there have not been problems like what we've had
with simple JNI actors and with the Matlab actor.  More research 
is in order, I'd like to be sure that we understand this.

More cleanup of the launcher code is in order.  I need to look
at the copyright etc.

Also, the Ptolemy JNI UI is a mess, it would be worth fixing this
because I keep getting questions about it.  Removing it from the tree
is an option, but the problem is that then people download Ptolemy II
4.0 and ask questions about it, which is basically unsupportable since
I'm always saying, "Upgrade".

_Christopher



More information about the Kepler-dev mailing list