When compiling a Java program that uses ILOG CPLEX Concert Technology, you need to inform the Java compiler where to find the file cplex.jar containing the ILOG CPLEX Concert Technology class library. To do this, you add the cplex.jar file to your classpath. This is most easily done by passing the command-line option
cplex.jar
-classpath <path_to_cplex.jar>
to the Java compiler javac. If you need to include other Java class libraries, you should add the corresponding jar files to the classpath as well. Ordinarily, you should also include the current directory '.' to be part of the Java classpath.
javac
jar
.
At execution time, the same classpath setting is needed. Additionally, since CPLEX is implemented via JNI, you need to instruct the Java Virtual Machine (JVM) where to find the shared library (or dynamic link library) containing the native code to be called from Java. This may be done with the command line option
-Djava.library.path=<path_to_shared_library>
to the java command. Note that, unlike the cplex.jar file, the shared library is system dependent; thus the exact pathname, of the location for the library to be used, differs depending on the platform you are using.
java
Pre-configured compilation and runtime commands are provided in the standard distribution, through the Unix makefiles and Windows "javamake" file for Nmake. However, these scripts presume a certain relative location for the files mentioned above, and for application development most users will have their source files in some other location.
javamake
Nmake
Below are suggestions for establishing build procedures for your application.
readme.html
<machine>
<libformat>
examples
<machine>/<libformat>
<compiler>\<libformat>
makefile
make execute_java
nmake -f javamake execute