JPL is a library using the SWI-Prolog foreign interface and the Java jni interface providing a bidirectional interface between Java and Prolog that can be used to embed Prolog in Java as well as for embedding Java in Prolog. In both setups it provides a reentrant bidirectional interface.

Installing SWI-Prolog with JPL in Linux

Notice: Based on first-hand experience, the use of standard swi-prolog packages in Debian-based distributions is not recommended, due to the following:

  • swi-prolog is absent in Debian Etch whatsoever (packages can be found in unstable and testing branches though),
  • JPL is not included in Debian/Ubuntu packages (probably due to licensing issues, see below),
  • the standard package name (pl) has been changed to swi-prolog; that is known to break some things, including XPCE.

With the above in mind, the following options are available:

  • use the stable RPM package available at the SWI-Prolog download page (RPM-based distros only),
  • install from source (coming soon), FIXME
  • convert the RPM package to DEB (in this case, rather harmless) or use the converted package,
  • use binary packages compiled from the source (coming soon). FIXME

Alternatively, you can use the repository packages and install JPL as standalone. For now, posts #6 and #7 in this discussion should provide some insight.

Installing SWI-Prolog with JPL in Mac OS X

Installation and testing instructions for Mac OS X can be found here.


DIYers should find this handy.


The following can be used to test whether JPL is working properly:

  • go to the lib directory of your JPL-enabled SWI-Prolog installation:
    • if you're using Linux and installed the RPM package: /usr/lib/pl-<version>
    • if you're a Mac user: /opt/local/lib/swipl-<version>
  • cd to doc/packages/examples/jpl/java/Test
  • delete Test.class to force re-compilation of the test app
  • launch ./
  • if all goes well, you should get something like this:
bash-3.2# ./
Compiling Test

JPL demo: Test

test 0...% compiled 0.00 sec, 4,064 bytes
test 1...passed.
test 2...passed.
test 3...passed.
test 4...passed.
test 5...passed.
test 6...passed.
test 7...passed.
test 8...passed.
test 9...passed.
test 10...passed.
test 11...passed.
test 101...00004567182904567231901235678312041678321528904567312936890412738905683412794156842736189057340412506823420839420831756240819623751407856239104837562910482956804237195684739158764391584763596579576799passed.


The following SWI-Prolog with JPL packages are available:

  • Debian/Ubuntu, converted from original RPMs: 5.6.54
  • OS X 10.4 and 10.5 users can get their installers here

For DIY:


Some insight plus specs:

  • jpl is supposed to work with sun jdk only! (as stated by Jan W.)
  • the main reason why jpl is not enabled in standard debian/ubuntu is the fact, that sun jdk is not free
  • so compilation of jpl is disabled in debs by a debian patch, BUT removing the patch does not result in a working packages! why?
  • we assume, that the packages built will use the standard sun-jdk packages, as generated by the java-package for etch (and hardy)
  • working with jdk 1.5 is a must!
  • working with jdk 1.6 should also be tested and reported! use java-package from lenny
  • it should be tested using current swi versions from both testing and sid!
  • check what changed (java package and swi vers) in intrepid ibex
  • some main problems with jpl include a proper location and config. (paths, env vars) for and jpl.jar
  • I assume we get OS X instructions completely free too :-)
  • in the future we might consider testing with openjdk, icedtea, classpath,gcj, whatever… but not now.

Grzegorz J. Nalepa 2008/07/05 10:44

Some demo projects to test:

Grzegorz J. Nalepa 2008/07/05 11:04

pl/prolog/jpl/jpl.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna) Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0