JPL 3.x installation
First check that the prerequisites (see the home page) are satisfied
(you have SWI-Prolog 5.2.0 or later, a Java 2 SDK, and a compatible
operating
system).
Unzip jpl.zip
somewhere
safe (maybe into the \pl
folder of your SWI-Prolog
installation): it creates a folder \jpl
which you should retain.
Inspect your new \jpl
folder: it should contain
jpl
+--- examples
| +--- Exceptions
| +--- Exceptions2
| +--- Family
| +--- Test
| +--- Test2
| +--- Time
| +--- Zahed
| +--- (and maybe more...)
|
+--- docs (HTML files in here are accessible via links from the home page)
|
+--- src
| +--- c
| | +--- build.bat (Windows script to recompile jpl.c to jpl.dll)
| | +--- build.sh (Linux script to recompile jpl.c to libjpl.so)
| +--- java
|
+--- jpl.dll (a native library - for Windows in this case)
|
+--- jpl.jar (a Java library)
|
+--- jpl.pl (a Prolog library)
|
+--- README.html (JPL's documentation "home page")
Put the three library files (jpl.dll, jpl.jar
and jpl.pl) where
each
can be found:
- jpl.dll must be
found
by the Windows kernel,
and can go in any folder on your PATH;
perhaps %SWI_HOME_DIR%\bin
or your Windows system folder
- jpl.jar must be
found
by any Java VMs
(and compilers) used with JPL;
one possibility is to put it on your global CLASSPATH
- jpl.pl is a Prolog
source
module, and must be found by any SWI-Prolog
engines used with JPL:
I suggest putting it in %SWI_HOME_DIR%\library
and then invoking make_library_index/1
on that folder (see a SWI-Prolog
manual for details) so that the autoloader can find it.
For SWI-Prolog to
initialise
(or make the first call) to JPL,
it is necessary that a folder containing the JVMlibrary
(jvm.dll) is on your PATH;
if you are using a recent Sun JRE,
look for a PATH entry of the form C:\jdk1.3.1_01\jre\bin\hotspot;
or C:\jdk1.3.1_01\jre\bin\client;
If your applications start in Java, and then call SWI-Prolog,
it is necessary that the SWI-Prolog
library libpl.dll
is in a folder on the PATH
Try the Java example in
examples/java/Versions
or the Prolog example in
examples/prolog/jpl_versions_demo.pl
to confirm that all three libraries are installed and compatible.
Installation troubleshooting
If the example programs don't run successfully, look carefully at any
error
messages; they typically indicate where the problem lies. Then
check
the installation instruction s and prerequisites carefully.
- If you get a message about
... jpl.dll ... Access is denied ...
then you may have lost execute
permission
on jpl.dll
(please consult local Windows expertise
if you don't know how to correct this).
- If jpl_examples/0
complains that
The
dynamic link library jvm.dll could not be found in the specified path
then you should locate jvm.dll within
the
Java runtime which you intend to use, and ensure that its directory is
within the PATH.
- if the Java examples (e.g. jpl\examples\Exception\run.bat)
complain that
The
name specified is not recognized as an internal or external command,
operable
program or batch file.
then there is no Java executable java.exe
in any folder on your PATH: you should have a PATH entry such as C:\jdk1.3.1_01\bin;
- if the Java examples complain that
The
dynamic link library libpl.dll could not be found in the specified path
or
Exception
in thread "main" java.lang.UnsatisfiedLinkError: C:\paul\bin\jpl.dll:
Can't
find dependent libraries
then there is no SWI-Prolog
library libpl.dll
in any folder on your PATH: you should have a PATH entry such as C:\Program
Files\pl\bin
Paul Singleton
February 2004