Once the toolbox is installed, there are some things you need to configure for its correct working, before using it:
When the Java native code is compiled, a dynamic library (.dll) or a shared object (.so) is created. To ensure that the Java virtual machine finds them, you must set the path in which these native libraries are searched for, so that it includes the names of the directories that contain the previously created native libraries. In a Unix system, the environment variable LD_LIBRARY_PATH contains this path; in a Windows system, we need to set the environment variable PATH.
If the user of the previous examples has followed all the installation steps, he will have the following native libraries:
~/Libraries/ssGA/ga/ssGA/libga_ssGA_MATLABProblemLocal.so
~/Libraries/jEA/class/pfc/ea/libpfc_ea_MATLABProblemLocal.so
~/Libraries/jEA/class/pfc/ea/operators/libpfc_ea_operators_MATLABOperatorLocal.so
~/MHTB/Server/libserver_MATLABServer_Daemon.so
~/MHTB/Server/libserver_LocalServer.so
He will need to set up the variable LD_LIBRARY_PATH to include these directories. To do so, he will key in the following:
$ LD_LIBRARY_PATH = $LD_LIBRARY_PATH:~/Libraries/ssGA/ga/ssGA:
~/Libraries/jEA/class/pfc/ea:
~/Libraries/jEA/class/pfc/ea/operators:
~/MHTB/Server
$ export LD_LIBRARY_PATH
To set up the variable PATH on a Windows machine you go to the Control Panel and double-click the System icon. In the Advanced tab you click on the Environment variables button. There you edit the variable PATH, so that it includes the paths to the directories containing the native libraries.
To be able to launch the evaluation server manually from outside MATLAB, you need to add another directory to the native library path, the one containing the libraries that allow access to MATLAB. If the user of the previous examples wants to launch the server manually and MATLAB is installed on /usr/Matlab, he will key in the following:
$ LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/usr/Matlab/bin/glnx86
$ export LD_LIBRARY_PATH
In Windows systems these libraries are located in the directory bin/win32 of the MATLAB installation, so that is the path you will need to add to the variable PATH.
To make the Java classes of the libraries available to MATLAB, you need to edit the file classpath.txt and add their locations. This file is in the directory toolbox/local of the MATLAB installation. You need to add a line for each location. The user of the previous examples will add the following lines:
~/Libraries/ssGA
~/Libraries/jEA/class
~/MHTB/Server/class
If the user does not have permissions to modify that file or he does not want the changes to affect anyone else, he will copy it into the directory MHTB and then he will modify it. When MATLAB starts, it first searches this file in the current directory and then in toolbox/local.
The classes of the evaluation server need to be accesible, so you must add the directory containing them to the Java classpath (stored in the environment variable CLASSPATH). The user of the previous examples would add, in the same way seen for the variable LD_LIBRARY_PATH, the directory MHTB/Server/class to this variable.
When you invoke a function, MATLAB searches for it through a set of directories, besides the present working directory. These directories are stored in the environment variable MATLABPATH. You need to add the directories MHTB, MHTB/functions and MHTB/operators to this variable. Yo can set it in the same way as LD_LIBRARY_PATH and PATH.
MATLAB ships with one specific version of the Java Virtual Machine (MATLAB 6.5, for example, incorporates JVM 1.3.1) and it uses this version by default with the MATLAB interface to Java. To get MATLAB to use a different version, you must find the root of the run-time path for the new JVM and then set the MATLAB_JAVA environment variable to this path. To locate the JVM run-time path, you find the directory in the Java installation tree that is one level up from the directory containing the file rt.jar. For example, if rt.jar is in /usr/java/jre/lib, you set MATLAB_JAVA to /usr/java/jre. Yo can set this variable in the same way as LD_LIBRARY_PATH and PATH.