Node:Interfacing with Java, Previous:Interfacing with Tcl/Tk, Up:Interfacing with Other Languages

Interfacing with Java

I'm having basic trouble in getting Java to work.

First try to get a simple "Hello world" program to work that does not use Jasper. A large portion of the support questions we get are unrelated to the SICStus Java interface. Once you can compile and run your own Java classes it should be relatively easy to get Jasper to work.

Read the Release Notes and the User's Manual and the section in them related to Jasper.

I want to use Jasper from an applet, but my browser won't let me.

Jasper is built as a layer on top of SICStus' C-Prolog interface and hence Jasper needs to be able to call methods declared as native (i.e., C functions). For security reasons, this is prohibited in applets.

This is a serious restriction, and future versions of Jasper will most likely allow connecting to the Prolog engine via sockets. In the interim, there are some examples on this at the Don't Panic page at

I get the message "Failed to locate bootfile" when running java ClassUsingJasper.

The answer to this (and related questions) can be found in the Jasper chapter of the Release Notes, section "Getting Started".

My first test of Java calling SICStus under MacOS X (i.e. calling se.sics.jasper.SICStus) failed with the following message. Yes, I set the java.library.path.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/ptollinger/bin/powerpc-apple-darwin/lib/libspnative.jnilib:
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(
        at java.lang.ClassLoader.loadLibrary(
        at java.lang.Runtime.loadLibrary0(
        at java.lang.System.loadLibrary(
        at se.sics.jasper.SICStus.loadNativeCode(
        at se.sics.jasper.SICStus.initSICStus(
        at se.sics.jasper.SICStus.<init>(
        at se.sics.jasper.SICStus.main(

You need to set DYLD_LIBRARY_PATH to include the SICStus runtime library:

bash> export DYLD_LIBRARY_PATH=location of libsprt312.dylib