there should be a "jpl.jar" in /usr/lib/swipl-5.10.1/lib and libswipl.so in /usr/lib/swipl-5.10.1/lib/i686-linux.
Yes, I can find it.
First, I add external JAR [jpl.jar]in Eclipse
Second, I set native library location of jpl.jar in Eclipse
/usr/lib/swipl-5.10.1/lib/x86_64-linux
Third, I set VM arguments in Eclipse
-Djava.library.path=.:/usr/lib/swipl-5.10.1/lib/i686-linux
Then,
I got this error Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpl in java.library.path
So, I found another site and I use this setting.
First, I add external JAR [jpl.jar] in Eclipse
Second, I set variable under environment in Eclipse
LD_LIBRARY_PATH /usr/lib/swipl-5.10.1/lib/x86_64-linux
SWI_HOME_DIR /usr/lib/swipl-5.10.1
Then I run it without setting VM arguments and got the same error.
Even if I run it again after setting VM arguments in Eclipse, I can't fix the error.
Please. give me advice to fix it. If you know how to fix it, please explain how to fix the error.
Thank you.
Carlo Capelli
unread,
May 23, 2016, 1:39:52 AM5/23/16
to Kyonmo Yang, SWI-Prolog
not sure it will help for your use case, but I recently started a server from scratch, and to get SWI-Prolog built from source with JPL, I used
JPL_DEP_ROOT=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JPL_DEP_ROOT:$JPL_DEP_ROOT/server
LD_LIBRARY_PATH=~/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
HTH Carlo
Kyonmo Yang
unread,
May 23, 2016, 2:23:45 AM5/23/16
to SWI-Prolog, kmya...@gmail.com
Thanks for your answer. I have done according to your suggestions but it doesn't work. :[
Thanks
2016년 5월 23일 월요일 오후 2시 39분 52초 UTC+9, cc.carlo.cap 님의 말:
Paul Singleton
unread,
May 23, 2016, 8:02:44 AM5/23/16
to SWI-Prolog
You tell us your jpl.jar is in
/usr/lib/swipl-5.10.1/lib
but that you have configured Eclipse to fail to find it in
/usr/lib/swipl-5.10.1/lib/x86_64-linux
or
/usr/lib/swipl-5.10.1/lib/i686-linux
Determine where it actually is [e.g. by looking] then nominate this path to Eclipse.
Paul Singleton
Kyonmo Yang
unread,
May 23, 2016, 9:05:04 PM5/23/16
to SWI-Prolog
Thank you!!!!!!!!!
I use incorrect path in VM argument in Eclipse.
I can use JPL through this configuration below
Location of swipl-5.10.1: usr/lib/swipl-5.10.1
1. copy libswipl.so file[/usr/lib/swipl-5.10.1/lib/x86_64-linux] to usr/lib
if you need root permission, you can use this command: gksu nautilus
2. add jpl.jar[/usr/lib/swipl-5.10.1/lib] library in Eclipse
Properties->Java Build Path->Libraries->Add External JARs
3. set Naive library location of jpl.jar [/usr/lib/swipl-5.10.1/lib/x86_64-linux]
4. set VM arguments [-Djava.library.path=.:/usr/lib/swipl-5.10.1/lib/x86_64-linux]
Run->Run configuration->Arguments
I don't need to set this path under /etc/environment or ~/.bashrc
LD_LIBRARY_PATH="/usr/lib/swipl-5.10.1/lib/x86_64-linux"
SWI_HOME_DIR="/usr/lib/swipl-5.10.1"
Thank you!
2016년 5월 23일 월요일 오후 9시 2분 44초 UTC+9, Paul Singleton 님의 말:
Jan Wielemaker
unread,
May 24, 2016, 3:05:12 AM5/24/16
to Kyonmo Yang, SWI-Prolog
On 05/24/2016 03:05 AM, Kyonmo Yang wrote: \> Thank you!!!!!!!!! \> \> I use incorrect path in VM argument in Eclipse. \> \> I can use JPL through this configuration below \> \> Location of swipl-5.10.1: usr/lib/swipl-5.10.1 \>
\> 1. copy *libswipl.so* file[/usr/lib/swipl-5.10.1/lib/x86_64-linux] to \> usr/lib \> if you need root permission, you can use this command: *gksu nautilus *
It is quite unlikely that is a good idea. It most likely creates to version issues when you upgrade SWI-Prolog.
\> 2. add *jpl.jar*[/usr/lib/swipl-5.10.1/lib] library in Eclipse
\> Properties->Java Build Path->Libraries->Add External JARs
I guess that is fine.
\> 3. set *Naive library* location of jpl.jar \> [/usr/lib/swipl-5.10.1/lib/x86_64-linux]
That might be fine too. Note there are two libraries involved in this case: jpl.so, which contains the Java to Prolog interface and libswipl.so, which contains the [embeddable Prolog kernel.
\> 4. set *VM arguments*
\> [-Djava.library.path=.:/usr/lib/swipl-5.10.1/lib/x86_64-linux] \> Run->Run configuration->Arguments
That tells Java where to look for .so files. Not sure how this compares to [3].
\> I don't need to set this path under /etc/environment or ~/.bashrc \> LD_LIBRARY_PATH="/usr/lib/swipl-5.10.1/lib/x86_64-linux" \> SWI_HOME_DIR="/usr/lib/swipl-5.10.1"
Setting $LD_LIBRARY_PATH is probably the alternative to copying libswipl.so. What [I think] happens is this:
Java is supposed to dynamically load jpl.so. Jpl.so has a dependency on libswipl.so and thus loading jpl.so should load libswipl.so as well. Now, on Linux the search path for shared objects cannot be changed at runtime [AFAIK, please correct me if this has changed]. So, one of the options you gave made it find jpl.so using its own file search. It tries to dlopen[] /usr/lib/swipl-5.10.1/lib/x86_64-linux/jpl.so, which cause it to use the OS search for the dependency libswipl.so. This fails. You're action to copy libswipl.so fixes this. Setting LD_LIBRARY_PATH should have fixed that too. Note that after editing ~/.bashrc you should either logout and back in or you should run `source ~/.bashrc` to make the changes visible.
If you compiled the binary from source, it uses the shared object runpath feature to compile the search path into jpl.so, so all works fine. Using runpath is however against the policy of Debian packages. Not sure what the clean way out is that does not violate the Debian package policies.
Cheers --- Jan
\> \> \> Thank you! \> \> \> \> \> \> 2016년 5월 23일 월요일 오후 9시 2분 44초 UTC+9, Paul Singleton 님의 말: \> \> You tell us your jpl.jar is in \> \> | \> /usr/lib/swipl-5.10.1/lib \> | \> \> but that you have configured Eclipse to fail to find it in \> \> | \> /usr/lib/swipl-5.10.1/lib/x86_64-linux \> | \> \> \> or \> \> | \> /usr/lib/swipl-5.10.1/lib/i686-linux \> | \> \> \> Determine where it actually is [e.g. by looking] then nominate this \> path to Eclipse. \> \> Paul Singleton \>
\> -- \> You received this message because you are subscribed to the Google \> Groups "SWI-Prolog" group. \> To unsubscribe from this group and stop receiving emails from it, send \> an email to swi-prolog+...@googlegroups.com
\> .
neha sood
unread,
Aug 9, 2016, 6:44:55 AM8/9/16
to SWI-Prolog
Hi All,
I am also stuck with this exception
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpl in java.library.path
My working environment is
IDE- EClipse mars 4.5 ,Java 8, Swipl -7.2.3, OS: Windows 10
I was successfully running prolog queries from eclipse IDE till yesterday but suddenly it has stopped working and started throwing this exception.
i have jpl.jar added at below paths
Image eclipse shows external library refered in source code
Image env show environment variable set in code
Path below source code also shows environment var path refering to Swipl
Also classpath refers to jpl.jar as
Classpath=C:\Program Files\swipl\lib\jpl.jar
Source code is
public class Jpc {
public static void main[String args[]]
{ String t1="consult['C:/Users/researcher/Desktop/prolog basics/stat.pl']";
Query q1=new Query[t1];
System.out.println[t1+" "+ [q1.hasSolution[] ? "success" : "not connected" ]];
}
}
and output of code is
path C:\Program Files\Java\jdk1.8.0_65\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32; C:/Program Files/Java/jdk1.8.0_65/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_65/bin/../jre/lib/amd64;C:\Program Files\Java\jdk1.8.0_65\bin; c:\php; c:\Apache24; c:\Apache24\bin;