Embedding

The archive file can be embedded into variety of Hotspot applications. Let’s look at the case of an embedding inside a Java standalone application. Assume that your Java class <main> has a static method main() and that it resides inside the destination directory <dest>. Assume further that this class will use the Hotspot runtime library of Jekejeke Prolog:

interpreter.jar

You might copy the archive file to the destination directory <dest> of your choice. There is no need to unpack the archive file. Assume your Java class <main> with a static method main() is inside the destination directory <dest> as well. Assume further that this class will use the runtime library.

You will first need a Java development kit so that you have a Java compiler available. Your Java class <main> can be compiled by the following command form the destination directory <dest>. Note the different path separators on the different platforms:

javac –cp interpreter.jar;. <main>.java    # on windows
javac –cp interpreter.jar:. <main>.java    # on linux and mac

You will then need a Java runtime environment so that you have a Java runtime available. Your Java class <main> can be executed by the following command from the destination directory <dest>. Note again the different path separators on the different platforms:

java –cp interpreter.jar;. <main>          # on windows
java –cp interpreter.jar:. <main>          # on linux and mac

Alternatively you can use an integrated development environment to compile and execute your Java class. All you probably have to do is create an appropriate project and then register the archive file of the Jekejeke Prolog runtime library in the class path of the project.

You might also unpack the Jekejeke Prolog runtime library and include it in a .jar together with your compiled byte code and then execute this .jar.

Further you might want to deploy the Jekejeke Prolog runtime library together with your applets or servlets. In the case of applets all you need to do is mention the archive file in the applet tag and copy the archive file to the web server together with the applet. In case of servlets all you need to do is copy the archive file into the WEB-INF/lib directory. For more details see the deployment study document.

Kommentare