How to launch the interfaces examples

Provides instructions on how to set the environment variables, which JDKs are supported, and how to run the sample models.

First make sure that your environment variables are correctly set, as explained in the following section Common Settings, then follow the language-specific instructions.

Common settings

On Windows platforms, make sure that the path
<Install_dir>\opl\bin\<port>
is in your PATH environment variable, so that the shared libraries are found.

On UNIX platforms, make sure that

<Install_dir>/opl/bin/<port>
is in your LD_LIBRARY_PATH environment variable, so that the shared libraries are found.

C++ examples

In Microsoft Visual Studio, open

<Install_dir>\opl\examples\opl_interfaces\cpp\<your port>\stat_mda\examples.sln

You can then compile and launch each example of the solution.

On UNIX platforms, go to the directory

<Install_dir>/opl/examples/opl_interfaces/cpp/<your platform>

and type make.

The examples are compiled, then executed.

.NET examples

In Microsoft Visual Studio, open

<Install_dir>\opl\examples\opl_interfaces\dotnet\<your port>\VisualBasic\examples.sln

or

<Install_dir>\opl\examples\opl_interfaces\dotnet\<your port>\CSharp\examples.sln

You can then compile and launch each example of the solution.

Java examples

Important: You must have JDK 8.0 or above installed on your machine to run the Java™ examples.

On Windows platforms, each example in

<Install_dir>\opl\examples\opl_interfaces\java

has a Run.bat batch script that invokes Ant.

To compile and launch a Java code sample, go to the subdirectory for that sample and double-click the Run.bat file. For example, double-click

<Install_dir>\opl\examples\opl_interfaces\java\cutstock\Run.bat

to compile and launch the cutstock code sample.

On UNIX platforms, go to the directory of the example

<Install_dir>/opl/examples/opl_interfaces/java/<an example>

You can then launch the example using Ant. Type

<Install_dir>/opl/ant/bin/ant

The example is compiled, then run. You can add the verbose option to see the exact Java command used to launch the example, like this:

<Install_dir>/opl/ant/bin/ant -verbose