Launch and build example programs

 

Running an example

Open Inventor Java is provided with few pre-compiled examples. Each one can be launched using any of the following ways:

  1. Run any example by a double click (Windows. requires you have configured your environment )
    For instance using your favorite file explorer, go to %OIVJHOME%/examples/inventor/viewercomponents/swt/glcanvas/renderareaguiintegration and double click on Main.jar

  2. Run any example by using java -jar
    For instance:
    cd %OIVJHOME%/examples/inventor/viewercomponents/swt/glcanvas/renderareaguiintegration
    java -jar Main.jar

  3. Run any example by using Eclipse ide
    You must create an Eclipse project by importing the ant script file $OIVJHOME/examples/build.xml
    • File / New / Project
    • Select "Java Project from Existing Ant Buildfile"
    • Select "Next"
    • In the "Ant buildfile" area, browse $OIVJHOME/examples/build.xml
    • In the “Select javac declaration to use to define project” area, select “javac” task found in target “javac”
    • Select "Link to the buildfile in the file system" (optional)
    • Select "Finish"
    • Once the project is loaded, select for instance inventor.viewercomponents.swt.glcanvas.renderareaguiintegration
    • right click "Run As/Java application"
    • You will have to configure the demo by adding the path to the native librairies of OivJava (provided in the folder $OIVJHOME/jre/bin)

Modifying and recompiling examples

The examples program source are organized in java packages. So under $OIVJHOME/examples you will find

In order to modify a example and recompile it, you must use the provided ant script $OIVJHOME/examples/build.xml. Of course you must install the ant tool. (see http://ant.apache.org).

To list the available targets of this ant script:

To recompile any example:
Notes:

This command re-compiles all needed examples (generates .class files) and build all the executable jars.

The ant script uses a custom ant task to build these executable jars. This custom task is provided by the CreateExecutableDemosJars.jar. Do not remove it!