Lisp HUG Maillist Archive

[ANN] jfli beta available

A beta of jfli, an open-source Java Foreign Language Interface for
LispWorks, is now available:

http://jfli.sourceforge.net



Re: [ANN] jfli beta available

On Sat, 10 Jul 2004 22:13:26 -0400, "Rich Hickey" <rich@richhickey.com> wrote:

> A beta of jfli, an open-source Java Foreign Language Interface for
> LispWorks, is now available:
>
> http://jfli.sourceforge.net

Cool! Thanks for this great contribution!

Unfortunately, I seem to have problems using jfli on Linux (Debian
testing with Sun JDK 1.4.2_04). Here's what happens:

  edi@bird:/tmp/jfli$ ls -ltr /usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so 
  -rwxrwxr-x    1 root     src       5178631 Feb 24 16:23 /usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so
  edi@bird:/tmp/jfli$ lw
  LispWorks(R): The Common Lisp Programming Environment
  Copyright (C) 1987-2003 Xanalys LLC.  All rights reserved.
  Version 4.3.7
  Saved by root as lw-console, at 07 Jul 2004 3:31
  User edi on bird.agharta.de
  ; Loading text file /usr/lib/lispworks43/lib/4-3-0-0/config/siteinit.lisp
  ;  Loading text file /usr/lib/lispworks43/lib/4-3-0-0/private-patches/load.lisp

  CL-USER 1 > (load "jni")
  ; Loading fasl file /tmp/jfli/jni.ufsl
  #P"/tmp/jfli/jni.ufsl"

  CL-USER 2 > (load "jfli")
  ; Loading fasl file /tmp/jfli/jfli.ufsl
  #P"/tmp/jfli/jfli.ufsl"

  CL-USER 3 > (use-package :jfli)
  T

  CL-USER 4 > (setf *jni-lib-path* "/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so")
  "/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so"

  CL-USER 5 > (create-jvm "-Djava.class.path=/tmp/jfli/jfli.jar")
  Error occurred during initialization of VM
  Unable to load native library: libjvm.so: cannot open shared object file: No such file or directory
  edi@bird:/tmp/jfli$ 

Am I doing something wrong?

LispWorks is 4.3.7 professional.

Thanks again,
Edi.


RE: [ANN] jfli beta available

I don't have Linux, so I'll just have to take a guess.

You may need to set the java.library.path - see the way it's done in
examples/swtdemo.lisp. Set it to be the path that contains libjvm.so.

Hope that helps,

Rich

-----Original Message-----
From: owner-lisp-hug@xanalys.com [mailto:owner-lisp-hug@xanalys.com] On
Behalf Of Edi Weitz
Sent: Sunday, July 11, 2004 1:38 AM
To: Rich Hickey
Cc: lisp-hug@xanalys.com
Subject: Re: [ANN] jfli beta available

On Sat, 10 Jul 2004 22:13:26 -0400, "Rich Hickey" <rich@richhickey.com>
wrote:

> A beta of jfli, an open-source Java Foreign Language Interface for
> LispWorks, is now available:
>
> http://jfli.sourceforge.net

Cool! Thanks for this great contribution!

Unfortunately, I seem to have problems using jfli on Linux (Debian
testing with Sun JDK 1.4.2_04). Here's what happens:

  edi@bird:/tmp/jfli$ ls -ltr
/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so 
  -rwxrwxr-x    1 root     src       5178631 Feb 24 16:23
/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so
  edi@bird:/tmp/jfli$ lw
  LispWorks(R): The Common Lisp Programming Environment
  Copyright (C) 1987-2003 Xanalys LLC.  All rights reserved.
  Version 4.3.7
  Saved by root as lw-console, at 07 Jul 2004 3:31
  User edi on bird.agharta.de
  ; Loading text file /usr/lib/lispworks43/lib/4-3-0-0/config/siteinit.lisp
  ;  Loading text file
/usr/lib/lispworks43/lib/4-3-0-0/private-patches/load.lisp

  CL-USER 1 > (load "jni")
  ; Loading fasl file /tmp/jfli/jni.ufsl
  #P"/tmp/jfli/jni.ufsl"

  CL-USER 2 > (load "jfli")
  ; Loading fasl file /tmp/jfli/jfli.ufsl
  #P"/tmp/jfli/jfli.ufsl"

  CL-USER 3 > (use-package :jfli)
  T

  CL-USER 4 > (setf *jni-lib-path*
"/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so")
  "/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so"

  CL-USER 5 > (create-jvm "-Djava.class.path=/tmp/jfli/jfli.jar")
  Error occurred during initialization of VM
  Unable to load native library: libjvm.so: cannot open shared object file:
No such file or directory
  edi@bird:/tmp/jfli$ 

Am I doing something wrong?

LispWorks is 4.3.7 professional.

Thanks again,
Edi.


Re: [ANN] jfli beta available

On Sun, 11 Jul 2004 08:17:59 -0400, "Rich Hickey" <rich@richhickey.com> wrote:

> I don't have Linux, so I'll just have to take a guess.
>
> You may need to set the java.library.path - see the way it's done in
> examples/swtdemo.lisp. Set it to be the path that contains
> libjvm.so.

Thanks to you and Barry Wilkes for your help. It seems like setting
java.library.path has no effect while using LD_LIBRARY_PATH makes a
difference. However, the result is still not what I'd like to have:

  edi@bird:/tmp/jfli$ echo $LD_LIBRARY_PATH 
  /usr/local/lib/j2sdk1.4.2_04/jre/lib/i386:/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client:/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/server
  edi@bird:/tmp/jfli$ lw
  LispWorks(R): The Common Lisp Programming Environment
  Copyright (C) 1987-2003 Xanalys LLC.  All rights reserved.
  Version 4.3.7
  Saved by root as lw-console, at 07 Jul 2004 3:31
  User edi on bird.agharta.de
  ; Loading text file /usr/lib/lispworks43/lib/4-3-0-0/config/siteinit.lisp
  ;  Loading text file /usr/lib/lispworks43/lib/4-3-0-0/private-patches/load.lisp

  CL-USER 1 > (load "jni")
  ; Loading fasl file /tmp/jfli/jni.ufsl
  #P"/tmp/jfli/jni.ufsl"

  CL-USER 2 > (load "jfli")
  ; Loading fasl file /tmp/jfli/jfli.ufsl
  #P"/tmp/jfli/jfli.ufsl"

  CL-USER 3 > (use-package :jfli)
  T

  CL-USER 4 > (setf *jni-lib-path* "/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so")
  "/usr/local/lib/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so"

  CL-USER 5 > (create-jvm "-Djava.class.path=/tmp/jfli/jfli.jar")
  edi@bird:/tmp/jfli$

At this point LW dies silently. Hmmm...

Cheers,
Edi.


Re: [ANN] jfli beta available

Some more data: When compiling "jni.lisp" I get this message:

  The following functions are undefined:
  SYSTEM:BIGNUM-FROM-64BIT which is referenced by (SUBFUNCTION JNI::|GET-STATIC-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|GET-STATIC-LONG-FIELD-thunk|)), (SUBFUNCTION JNI::|CALL-STATIC-LONG-METHOD-A-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|CALL-STATIC-LONG-METHOD-A-thunk|)), (SUBFUNCTION JNI::|GET-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|GET-LONG-FIELD-thunk|)), (SUBFUNCTION JNI::|CALL-NONVIRTUAL-LONG-METHOD-A-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|CALL-NONVIRTUAL-LONG-METHOD-A-thunk|)), and (SUBFUNCTION JNI::|CALL-LONG-METHOD-A-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|CALL-LONG-METHOD-A-thunk|))
  SYSTEM:INTEGER-TO-64BIT which is referenced by (SUBFUNCTION JNI::|SET-STATIC-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|SET-STATIC-LONG-FIELD-thunk|)) and (SUBFUNCTION JNI::|SET-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION JNI::|SET-LONG-FIELD-thunk|))

I also tried with this line

  ;  :module :jni-lib ;refused on Mac OSX, even though register-module is supported

uncommented but got the same result.

Cheers,
Edi.


RE: [ANN] jfli beta available

This is a limitation of LispWorks. Please join me in asking them to support
these functions on 32-bit platforms. They are required in order to cleanly
interoperate with the 64-bit Java long type.

I should have mentioned that these errors are expected, and are worked
around (via a combination of inefficiency and truncation) in the jfli layer.

-----Original Message-----
From: owner-lisp-hug@xanalys.com [mailto:owner-lisp-hug@xanalys.com] On
Behalf Of Edi Weitz
Sent: Sunday, July 11, 2004 1:48 AM
To: lisp-hug@xanalys.com
Subject: Re: [ANN] jfli beta available

Some more data: When compiling "jni.lisp" I get this message:

  The following functions are undefined:
  SYSTEM:BIGNUM-FROM-64BIT which is referenced by (SUBFUNCTION
JNI::|GET-STATIC-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|GET-STATIC-LONG-FIELD-thunk|)), (SUBFUNCTION
JNI::|CALL-STATIC-LONG-METHOD-A-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|CALL-STATIC-LONG-METHOD-A-thunk|)), (SUBFUNCTION
JNI::|GET-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|GET-LONG-FIELD-thunk|)), (SUBFUNCTION
JNI::|CALL-NONVIRTUAL-LONG-METHOD-A-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|CALL-NONVIRTUAL-LONG-METHOD-A-thunk|)), and (SUBFUNCTION
JNI::|CALL-LONG-METHOD-A-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|CALL-LONG-METHOD-A-thunk|))
  SYSTEM:INTEGER-TO-64BIT which is referenced by (SUBFUNCTION
JNI::|SET-STATIC-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|SET-STATIC-LONG-FIELD-thunk|)) and (SUBFUNCTION
JNI::|SET-LONG-FIELD-thunk| (FLI:DEFINE-FOREIGN-FUNCTION
JNI::|SET-LONG-FIELD-thunk|))

I also tried with this line

  ;  :module :jni-lib ;refused on Mac OSX, even though register-module is
supported

uncommented but got the same result.

Cheers,
Edi.


Re: [ANN] jfli beta available

On Sun, 11 Jul 2004 08:21:32 -0400, "Rich Hickey" <rich@richhickey.com> wrote:

> This is a limitation of LispWorks. Please join me in asking them to
> support these functions on 32-bit platforms. They are required in
> order to cleanly interoperate with the 64-bit Java long type.

I hope Xanalys is able to see what a great contribution to LispWorks
jfli is and will support it as needed in their next release.

Edi.


Re: [ANN] jfli beta available

On 11 Jul 2004, at 04:13, Rich Hickey wrote:

> A beta of jfli, an open-source Java Foreign Language Interface for
> LispWorks, is now available:
>
> http://jfli.sourceforge.net

This is really very cool! This is litteraly 'embrace and extend'.
Works like a charm for me (Mac OS X 10.3.4, LWM 4.3.7).

Is there a way to undo #'CREATE-JVM (to close or restart it), or is 
that not possible ?
In a long-running server process, this might be useful (e.g. when API 
changes).

Thanks Rich, for this work and making it publicly available.

Sven

PS: I am certainly going to try to use this in some more real-world 
situations.


RE: [ANN] jfli beta available

Unfortunately, there is no way to unload/restart the JVM. This is a
limitation of Java/JNI.

-----Original Message-----
From: owner-lisp-hug@xanalys.com [mailto:owner-lisp-hug@xanalys.com] On
Behalf Of Sven Van Caekenberghe
Sent: Sunday, July 11, 2004 4:16 AM
To: Rich Hickey
Cc: lisp-hug@xanalys.com
Subject: Re: [ANN] jfli beta available

On 11 Jul 2004, at 04:13, Rich Hickey wrote:

> A beta of jfli, an open-source Java Foreign Language Interface for
> LispWorks, is now available:
>
> http://jfli.sourceforge.net

This is really very cool! This is litteraly 'embrace and extend'.
Works like a charm for me (Mac OS X 10.3.4, LWM 4.3.7).

Is there a way to undo #'CREATE-JVM (to close or restart it), or is 
that not possible ?
In a long-running server process, this might be useful (e.g. when API 
changes).

Thanks Rich, for this work and making it publicly available.

Sven

PS: I am certainly going to try to use this in some more real-world 
situations.


Re: [ANN] jfli beta available

On 11 Jul 2004, at 04:13, Rich Hickey wrote:

> A beta of jfli, an open-source Java Foreign Language Interface for
> LispWorks, is now available:
>
> http://jfli.sourceforge.net

Rich,

I have a question regarding GC: what happens to objects that you create 
in the jvm using jfli in terms of their lifecycle ?
Can they become garbage while lisp is still holding references to them, 
or are they only gc-ed when the last lisp reference is gone ?

As for features, would it be possible to keep some of the meta info 
that you build up during def-java-class around for later use ?
I would for example like to have a simple way to convert a jfli pointer 
to a java object into a clos object of my own.
If I could ask the jfli object or class for all its java beans 
properties, that would be great.
Additionally, generic slot-value access using bean property names would 
be nice.

Sven

PS: Maybe these discussions have to move to another mailing list ? Is 
the one on sf.net already active ?


RE: [ANN] jfli beta available

Yes, the jfli-users list is now up:

https://lists.sourceforge.net/lists/listinfo/jfli-users

Thanks for the interest (and tolerance) of all here. We'll move the
discussion there.


-----Original Message-----
From: owner-lisp-hug@xanalys.com [mailto:owner-lisp-hug@xanalys.com] On
Behalf Of Sven Van Caekenberghe
Sent: Monday, July 12, 2004 9:45 AM
To: Rich Hickey
Cc: lisp-hug@xanalys.com
Subject: Re: [ANN] jfli beta available

.....

PS: Maybe these discussions have to move to another mailing list ? Is 
the one on sf.net already active ?


Updated at: 2020-12-10 08:55 UTC