Jasper is a bi-directional interface between SICStus Prolog and
Java. It is currently built on top of the JNI together with the
C-Prolog interface, and hence makes use of the native keyword in
Java. As a result, a Prolog-enhanced Java-program can not be used in
an applet, for example.
To use Jasper, you need a JNI-compatible Java-implementation installed on your system. Jasper has currently only been tested and verified with Sun's JDK 1.1.x, which can be downloaded from
http://java.sun.com/products/jdk/1.1/
Jasper should be able to use any Java-implementation as long as it is
JNI-compatible. However, the configure-script makes some assumptions
about the locations of header files and libraries which may not be valid
for other JDK's than Sun's own. So, if configure fails to locate the
correct header files and libraries, it may be necessary to manually set
the values of JAVAINC and JAVALIB. See `INSTALL' for
information on how to do this. In general, if you manage to get Jasper
working on a platform it is not know to work on (or if you don't),
please let us know by sending a mail to sicstus-support@sics.se.
Under `$SP_PATH/library/jasper/examples' there are a couple of examples on how to use the Java-interface.
If you want to call Java from Prolog, you must also make sure that
library(jasper) (the Prolog library module) was installed
correctly.
The interface can be used in two different ways, depending on which language is used at toplevel. Either SICStus is loaded as a runtime-system into Java:
% java JasperTestClass
or Java can be loaded into SICStus as a foreign resource:
% sicstus SICStus 3.7: Mon Mar 2 19:22:44 MET 1998 | ?- use_module(jasper). ...
The path to the SICStus library must be included in CLASSPATH (see
the documentation of your Java implementation for more details about how
to set this variable). For example, under UNIX:
% java -classpath $CLASSPATH:/usr/local/lib/sicstus37/library Class
or under Windows:
% java -classpath "%CLASSPATH%;c:\Program Files\sicstus37\library" Class
Also, the runtime linker must be able to locate the SICStus runtime kernel. This is usually handled automatically when running SICStus, but when Java is used as toplevel application, the system will usually not know where your SICStus application resides.
Under UNIX this is handled by setting the runtime linker search path
variable (usually LD_LIBRARY_PATH) to contain the path to the SICStus
runtime kernel (`libsprt37.so'), and by setting SP_PATH to
point out the location of the Runtime Library.
Under Windows, `sprt37.dll' must be located in one of the placed
the runtime linker searches in; the same directory as the executable,
the current directory, or the directories specified by PATH
(which includes the system directories).
The runtime linker must be able to locate the Java runtime kernel (`javai.dll' or `libjava.so'), according to the same rules as above.
The classpath variable is taken from the environment variable
CLASSPATH which therefore must contain the correct value.
Go to the first, previous, next, last section, table of contents.