Results 1 to 4 of 4
  1. #1
    xavi567 is offline Member
    Join Date
    Jun 2011
    Posts
    1
    Rep Power
    0

    Question Connecting Prolog with Java

    Hello,

    I want to connect prolog with java using the JPL library. I read the documentation about JPL and tried to make the Family example in a simple console applicacion, but when I try to run the program
    I get this exception:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpl in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java :1738)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at jpl.JPL.loadNativeLibrary(JPL.java:100)
    at jpl.fli.Prolog.<clinit>(Prolog.java:85)
    at jpl.Query.open(Query.java:286)
    at jpl.Util.textToTerm(Util.java:162)
    at jpl.Query.<init>(Query.java:198)
    at javaprolog.Family.main(Family.java:17)

    I use Netbeans IDE 7.0, JPL library dowloaded with SWI-Prolog in a Windows XP Service Pack 3 machine.

    Problem is, I read many webpages about these topic and none of the solutions worked for me. Some of them included creating new System Variables suchs as PATH, CLASSPATH, HOME, SWI_HOME, JAVA_HOME, or using a specific configuration in the virtual machine configuration when running your project (something like "-Djava.library.path='C:\Program Files\pl\lib'"), but none of these worked for me.

    So if anyone could enlighten me on how to connect java with prolog, please.

  2. #2
    Tomasz is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default Re: Connecting Prolog with Java

    Hi

    All I needed to connect Java with Prolog was (as you wrote) to modify/create some environment variables:
    SWI_HOME_DIR=C:\Program Files\pl #it's a prolog installation root directory
    PATH=%PATH%;C:\Program Files\pl\bin #path is extended by a directory with Prolog dll files / I guess this step can be replaced by adding a parameter -Djava.library.path=C:\Program Files\pl\bin to VM arguments

    after that path to jpl.jar should be added to classpath (it seems that you already did it)

    I know I'm responsing pretty late but maybe someone will need it. I hope it helps.

    Regards,

  3. #3
    Georgee is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default Re: Connecting Prolog with Java

    Quote Originally Posted by Tomasz View Post
    Hi

    All I needed to connect Java with Prolog was (as you wrote) to modify/create some environment variables:
    SWI_HOME_DIR=C:\Program Files\pl #it's a prolog installation root directory
    PATH=%PATH%;C:\Program Files\pl\bin #path is extended by a directory with Prolog dll files / I guess this step can be replaced by adding a parameter -Djava.library.path=C:\Program Files\pl\bin to VM arguments

    after that path to jpl.jar should be added to classpath (it seems that you already did it)

    I know I'm responsing pretty late but maybe someone will need it. I hope it helps.

    Regards,

    Hello,

    Could you explain in more detail how to modify the environment variables?

    Thanks
    Last edited by Georgee; 04-07-2012 at 01:08 AM.

  4. #4
    Tomasz is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default Re: Connecting Prolog with Java

    Hi,

    In Windows 7:
    start -> right click on "computer" -> properties -> "advanced system settings" -> "environment variables" button
    In Windows XP (quite alike):
    start -> right click on "my computer" -> properties -> select "advanced" tab -> "environment variables" button

    In the bottom table ("system variables") you can edit or add environments variables. If you edit Path variable remember to separate directories with semicolons.

    Cheers,

Similar Threads

  1. Using prolog at an Applet
    By zegjim in forum Advanced Java
    Replies: 0
    Last Post: 10-18-2010, 11:56 AM
  2. Replies: 3
    Last Post: 02-16-2010, 05:09 PM
  3. Connecting c with java
    By khajalid in forum Networking
    Replies: 6
    Last Post: 12-10-2008, 09:35 PM
  4. Connecting c with java
    By khajalid in forum Advanced Java
    Replies: 4
    Last Post: 09-11-2008, 04:47 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •