The Anatomy of a Concert Technology Application
To use the CPLEX Java interfaces, you need to import the appropriate packages into your application. This is done with the lines:
As for every Java application, a CPLEX application is implemented as a method of a class. In this discussion, we will assume the method to be the static main method. The first task is to create an IloCplex object. It is used to create all the modeling objects needed to represent the model. For example, an integer variable with bounds 0 and 10 is created by calling cplex.intVar(0, 10), where "cplex" is the IloCplex object.
Since Java error handling in CPLEX is done using exceptions, you should include the Concert Technology part of an application in a try/catch statement. All the exceptions thrown by any Concert Technology method are derived from IloException. Thus IloException should be caught in the catch statement.
In summary, here is the structure of a Java application that calls CPLEX: