Chapter 10.  Compiling Java Applications

HIPL software bundle includes also a java wrapper library to the HIP enabled libinet6 resolver library. The library is called "jip" and it is located in "path-to-hipl/jip". The use of the java library requires the HIP socket handler defined elsewhere in this document.

You need to have either Blackdown or Sun java jdk 1.4.x or later to compile jip. The code does *not* work on java 1.3. The installation assumes that you are using Blackdown 1.4 jdk, but if you are Sun jdk or other version of blackdown java, just set up the environment variable "JAVA_HOME" to point to the correct java installation directory.

Compile libinet6.so and jip:

The outcome of the previous operation is jip/jip.jar which you should use in your java applications to enable HIP. You can also run "make apidoc" to build the Javadoc documentation into the directory path-to-hipl/doc/jip-api.

There are three example java applications in "test" directory that you must compile manually with the following procedure:

You should have setup your networking environment as explained in Chapter 6, Testing a HIP connection between two locally connected hosts, that is, you should have configured your /etc/hosts and /etc/hip/hosts properly. However, hipd will automatically create your public keys, so you don't have to worry about them.

You cannot quite convert your normal Java networking application to a HIP application by just setting the socket factories. You will need to either ensure that a used host name always resolves only to IPv6 addresses, or that you never pass host names to methods in Socket and ServerSocket classes. This latter can be achieved by using the resolver methods in the HipAddress class as is done in the example.

Run the example applications as follows:

The shell script "test/java" contains some LD_PRELOAD, library and class path information necessary for executing the HIP enabled java applications.

The HipUserkeyClient class is otherwise the same as the HipClient class, except that its optional fourth argument is the name of a file from which to read an application-specified endpoint.