Just-JNI (call into Java from Perl only)
----------------------------------------

This has been tested with:

    Debian GNU/Linux 2.2 i386, perl 5.6.0, Kaffe (CVS, 2000-12-05 or later)
    RedHat 6.1, perl-5.00503-6 (RedHat RPM), IBM JDK 1.1.8
    Debian 2.1 SPARC, Perl 5.005_60, JDK 1.2 beta (crashes with AWT, though)
    Windows NT 4.0 SP4, ActivePerl 519, JDK 1.1.8, Visual C++
    Solaris 7, Perl 5.005_03, JDK 1.1.6, GCC 2.8.1

Solaris 7 Note (this probably applies to all native thread situations):

    Native threads were tricky. I had to build my own Perl, configured with:

    sh Configure -Dprefix=/opt/perl5.005 -Duseshrplib -Doptimize=-g \
                 -Uusemymalloc -D cc=gcc -Dusethreads -d

    When Configure let me edit config.sh, I changed libs to:

    libs='-lthread -lsocket -lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt'

    The leading -lthread is the only thing I had to add.

Kaffe Note:

I believe that Kaffe with JIT enabled will likely be problematic.  I had a
lot of trouble with it, that simply went away with interpreter-based Kaffe.
FWIW, here's how I configured Kaffe:

     env AM_CPPFLAGS=-DDEBUG CFLAGS="-O0 -ggdb" ./configure --disable-gcj \
                                                  --with-engine=intrp

Likely you don't need all that debugging stuff.

Also, when I build perl, I do this, to be on the safe side.  I was worried
about thread interaction, but realized there was no need to build threaded
perl, but I thought that the perl code should probably be reentrant, so, I
did this:

      sh ./Configure -Dcc=gcc -Doptimize='-D_REENTRANT -DDEBUGGING -ggdb'  \
                     -Dlibperl='libperl.so' -Duseshrplib='true' 

Again, you likely don't need the debugging flags.


How do I do this crazy thing?
-----------------------------

1) Cd into the JPL directory. Type the following:

    perl Makefile.PL
    make
    make install

   Under windows, that's:

    perl Makefile.PL
    nmake
    nmake install

3) cd into the JNI directory (cd ../JNI or cd ..\JNI)   

4) We now need to compile and make the Closer.class available to your 
   JPL program.  Closer is a WindowListener that closes the Frame we 
   make in the test program.

   It seems that we've managed to fix the problem with CLASSPATH not
   getting propagated to the JVM, so if '.' is in your CLASSPATH, you
   should be able to compile Closer.java and leave it in the current
   directory:

       javac Closer.java

     or perhaps

       jikes Closer.java

5) Make the demo:

    a) type the following:

      for SUN's proprietary software Java:

	env JAVA_HOME=/path/to/java perl Makefile.PL
	# setting the JAVA_HOME enviornment variable might not be needed
	# if Java is in installed in a canonical location
        make
        make test

      for Kaffe:

	env KAFFE_PREFIX=/kaffe/installation/prefix perl Makefile.PL
	# setting the KAFFE_PREFIX enviornment variable might not be needed
	# if Kaffe is in a canonical location
        make
        make test

       Under Windows:

        perl Makefile.PL
        nmake
        nmake test


    b) if all went well, type:

        make install

       or, under Windows:

        nmake install

