jpl java/swiprolog - PROLOG

This is a discussion on jpl java/swiprolog - PROLOG ; do you know jpl?It is an interface between java e swi-prolog. I'm trying to use it but i have a problem using it on Linux when I use Java and call prolog it's all ok, but when i call java ...

+ Reply to Thread
Results 1 to 7 of 7

jpl java/swiprolog

  1. Default jpl java/swiprolog

    do you know jpl?It is an interface between java e swi-prolog.
    I'm trying to use it but i have a problem using it on Linux

    when I use Java and call prolog it's all ok, but when i call java from
    prolog i receive this error message:

    test(X).
    ERROR: jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3

    the code of test is the following:

    :- use_module(library(jpl)).
    test(V):-jpl_call('java.lang.System',currentTimeMillis,[],V).

    Also the exmples give me the same error

    i have jpl.jar, libjava.so, libjpl.so in my PATH
    do i need something else???
    please help me

    10x 2 all.

  2. Default Re: jpl java/swiprolog

    On 2008-04-10, ruocco.andrea@gmail.com <ruocco.andrea@gmail.com> wrote:
    > do you know jpl?It is an interface between java e swi-prolog.
    > I'm trying to use it but i have a problem using it on Linux
    >
    > when I use Java and call prolog it's all ok, but when i call java from
    > prolog i receive this error message:
    >
    > test(X).
    > ERROR: jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3
    >
    > the code of test is the following:
    >
    >:- use_module(library(jpl)).
    > test(V):-jpl_call('java.lang.System',currentTimeMillis,[],V).
    >
    > Also the exmples give me the same error


    And you probably had errors while loading the code.

    > i have jpl.jar, libjava.so, libjpl.so in my PATH
    > do i need something else???


    ..so tells me Unix/Linux. PATH isn't used for finding .so files. On most
    Unix/linux systems this is LD_LIBRARY_PATH. Locate libjpl.so and use ldd
    libjpl.so to see whether all shared objects resolve. Fix problems you
    find.

    Cheers --- Jan

  3. Default Re: jpl java/swiprolog

    On 11 Apr, 09:31, Jan Wielemaker <j...@nospam.ct.xs4all.nl> wrote:
    > On 2008-04-10, ruocco.and...@gmail.com <ruocco.and...@gmail.com> wrote:
    >
    > > do you know jpl?It is an interface between java e swi-prolog.
    > > I'm trying to use it but i have a problem using it on Linux

    >
    > > when I use Java and call prolog it's all ok, but when i call java from
    > > prolog i receive this error message:

    >
    > > test(X).
    > > ERROR: jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3

    >
    > > the code of test is the following:

    >
    > >:- use_module(library(jpl)).
    > > test(V):-jpl_call('java.lang.System',currentTimeMillis,[],V).

    >
    > > Also the exmples give me the same error

    >
    > And you probably had errors while loading the code.
    >
    > > i have jpl.jar, libjava.so, libjpl.so in my PATH
    > > do i need something else???

    >
    > .so tells me Unix/Linux. PATH isn't used for finding .so files. On most
    > Unix/linux systems this is LD_LIBRARY_PATH. Locate libjpl.so and use ldd
    > libjpl.so to see whether all shared objects resolve. Fix problems you
    > find.
    >
    > Cheers --- Jan


    thanks for your help, but i did not resolve my problem
    i had:
    $ ldd libjpl.so
    linux-gate.so.1 => (0xffffe000)
    libjava.so => /usr/local/bin/libjava.so (0xb7e67000)
    libverify.so => not found
    libjvm.so => not found
    libgmp.so.3 => /usr/lib/libgmp.so.3 (0xb7e0e000)
    librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7e05000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7e01000)
    libreadline.so.5 => /lib/libreadline.so.5 (0xb7dd0000)
    libncursesw.so.5 => /lib/libncursesw.so.5 (0xb7d80000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7d5b000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0
    (0xb7d43000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7bf9000)
    libjvm.so => not found
    libverify.so => not found
    libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7be0000)
    /lib/ld-linux.so.2 (0x80000000)
    libncurses.so.5 => /lib/libncurses.so.5 (0xb7b9c000)

    then i put libjvm.so and libverify.so in my PATH and now i have:
    $ ldd libjpl.so
    linux-gate.so.1 => (0xffffe000)
    libjava.so => /usr/local/bin/libjava.so (0xb7ee4000)
    libverify.so => /usr/local/bin/libverify.so (0xb7ed8000)
    libjvm.so => /usr/local/bin/libjvm.so (0xb74db000)
    libgmp.so.3 => /usr/lib/libgmp.so.3 (0xb7483000)
    librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb747a000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7476000)
    libreadline.so.5 => /lib/libreadline.so.5 (0xb7445000)
    libncursesw.so.5 => /lib/libncursesw.so.5 (0xb73f6000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb73d0000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0
    (0xb73b8000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb726e000)
    libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7256000)
    /lib/ld-linux.so.2 (0x80000000)
    libncurses.so.5 => /lib/libncurses.so.5 (0xb7212000)

    It seems it's a ll ok , but i receive the same error running the code
    i mentioned before.

    i will be so grateful if you will help me to resolve the problem.
    thanks again

  4. Default Re: jpl java/swiprolog

    i receive also the following errors (during compiling):

    % library(lists) compiled into lists 0.00 sec, 15,888 bytes
    ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    '$open_shared_object'/3: libjava.so: cannot open shared object
    file: No such file or directory
    ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    library `java' does not exist (Please add directory holding
    libjava.so to $LD_LIBRARY_PATH)
    Warning: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    Goal (directive) failed: jpl: (initialization setup_jvm)
    ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4631):
    Exported procedure jpl:jpl_c_lib_version/1 is not defined
    % library(jpl) compiled into jpl 0.05 sec, 323,372 bytes
    % prova compiled 0.05 sec, 324,072 bytes



  5. Default Re: jpl java/swiprolog

    On 11 Apr, 10:20, ruocco.and...@gmail.com wrote:
    > i receive also the following errors (during compiling):
    >
    > % library(lists) compiled into lists 0.00 sec, 15,888 bytes
    > ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    > '$open_shared_object'/3: libjava.so: cannot open shared object
    > file: No such file or directory
    > ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    > library `java' does not exist (Please add directory holding
    > libjava.so to $LD_LIBRARY_PATH)
    > Warning: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    > Goal (directive) failed: jpl: (initialization setup_jvm)
    > ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4631):
    > Exported procedure jpl:jpl_c_lib_version/1 is not defined
    > % library(jpl) compiled into jpl 0.05 sec, 323,372 bytes
    > % prova compiled 0.05 sec, 324,072 bytes


    i tried doing this:

    export LD_LIBRARY_PATH=/usr/local/bin

    (in /usr/local/bin i have libjava.so)

    but nothing

  6. Default Re: jpl java/swiprolog

    On 2008-04-11, ruocco.andrea@gmail.com <ruocco.andrea@gmail.com> wrote:
    > On 11 Apr, 10:20, ruocco.and...@gmail.com wrote:
    >> i receive also the following errors (during compiling):
    >>
    >> % library(lists) compiled into lists 0.00 sec, 15,888 bytes
    >> ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    >> '$open_shared_object'/3: libjava.so: cannot open shared object
    >> file: No such file or directory
    >> ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    >> library `java' does not exist (Please add directory holding
    >> libjava.so to $LD_LIBRARY_PATH)
    >> Warning: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    >> Goal (directive) failed: jpl: (initialization setup_jvm)
    >> ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4631):
    >> Exported procedure jpl:jpl_c_lib_version/1 is not defined
    >> % library(jpl) compiled into jpl 0.05 sec, 323,372 bytes
    >> % prova compiled 0.05 sec, 324,072 bytes

    >
    > i tried doing this:
    >
    > export LD_LIBRARY_PATH=/usr/local/bin
    >
    > (in /usr/local/bin i have libjava.so)
    >
    > but nothing


    Surely you are doing something wrong that is related to this. It clearly
    says it cannot find the shared object. So either you run Prolog from
    another environment where your setting doesn't come through or the
    settings are wrong. If this is a GNU/Linux system. check "man ld.so",
    which lists various variables you can set to get more debugging output.

    You can also use "strace -o x pl" and check the contents of the file x.
    Its a bit hard to read, but searching for messages on the missing
    libraries should help.

    Cheers --- Jan

  7. Default Re: jpl java/swiprolog

    On 11 Apr, 11:25, Jan Wielemaker <j...@nospam.ct.xs4all.nl> wrote:
    > On 2008-04-11, ruocco.and...@gmail.com <ruocco.and...@gmail.com> wrote:
    >
    >
    >
    > > On 11 Apr, 10:20, ruocco.and...@gmail.com wrote:
    > >> i receive also the following errors (during compiling):

    >
    > >> % library(lists) compiled into lists 0.00 sec, 15,888 bytes
    > >> ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    > >> '$open_shared_object'/3: libjava.so: cannot open shared object
    > >> file: No such file or directory
    > >> ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    > >> library `java' does not exist (Please add directory holding
    > >> libjava.so to $LD_LIBRARY_PATH)
    > >> Warning: (/usr/lib/pl-5.6.43/library/jpl.pl:4629):
    > >> Goal (directive) failed: jpl: (initialization setup_jvm)
    > >> ERROR: (/usr/lib/pl-5.6.43/library/jpl.pl:4631):
    > >> Exported procedure jpl:jpl_c_lib_version/1 is not defined
    > >> % library(jpl) compiled into jpl 0.05 sec, 323,372 bytes
    > >> % prova compiled 0.05 sec, 324,072 bytes

    >
    > > i tried doing this:

    >
    > > export LD_LIBRARY_PATH=/usr/local/bin

    >
    > > (in /usr/local/bin i have libjava.so)

    >
    > > but nothing

    >
    > Surely you are doing something wrong that is related to this. It clearly
    > says it cannot find the shared object. So either you run Prolog from
    > another environment where your setting doesn't come through or the
    > settings are wrong. If this is a GNU/Linux system. check "man ld.so",
    > which lists various variables you can set to get more debugging output.
    >
    > You can also use "strace -o x pl" and check the contents of the file x.
    > Its a bit hard to read, but searching for messages on the missing
    > libraries should help.
    >
    > Cheers --- Jan


    i resolved
    i change my bash.bashrc adding LD_LIBRARY_PATH

    you have been very useful, 10x very much

+ Reply to Thread