Java: Debug your Java application when a crash or an exception occurs in Open Inventor
If a crash or an exception occurs in your application when using Open Inventor, it can be a crash inside the native libraries of Open Inventor. In that case it is impossible to get a useful traceback if your application use the default native libraries of Open Inventor.
In order to solve this issue and to communicate useful traceback to our customer support , we deliver what we call “debug” libraries of Open Inventor in addition to the default library. These libraries are functionally similar to the default one, but they contain additional debug information’s that are necessary to get native traceback when a crash occurs. Warnings : Using these libraries makes your application run much slower compare to using the default native libraries.
- These debug libraries can be found in be found in $OIVJHOME/jre/bin-debug
- In order to launch an application in full debug mode, your application must set the environment variable OIV_JAVA_LOAD_DEBUG_NATIVE_LIBRARIES to 1. When activated, Open Inventor loads the debug version of native dlls. As the debug version of these dlls are packaged in a separated folder, the PATH variable must be set to this one.
- You need to have Visual Studio 2015 installed on your machine. If not, you have to copy following libraries from a machine where Visual Studio 2015 is installed into $OIVJHOME/jre/bin-debug folder:
- These debug libraries can be found in $OIVJHOME/jre/lib/amd64-debug.
- In order to launch an application in full debug mode, your application must set the new environment variable OIV_JAVA_LOAD_DEBUG_NATIVE_LIBRARIES to 1. When activated, Open Inventor loads the debug version of native libraries. As the debug version of these libraries are packaged in a separated folder, the LD_LIBRARY_PATH variable must be set to this one.
Note: the debug libraries are useless during the run time of your application and they must not be distributed.
.Net : Use Managed Compatibility Mode
Even if a new version of the Visual Studio IDE generally comes with a new platform toolset/.NET framework, you can still use older ones. This means, for example, you can create a Visual Studio 2017 project and still referencing Visual 2015 assemblies.
If you're in such case (ie: Developping an application with Visual 2017 and referencing Visual 2015 Open Inventor assemblies) you may have problems while debugging your application. To avoid issues and see correct value of Open Inventor types like SbVec, SbMatrix etc, you need to activate the Managed Compatibility Mode in Visual Studio.
To do this, open the Debug menu of Visual Studio and select the Options... menu. In the new opened window, Select Debugging, General and scroll down until you see the option Use Managed Compatibility Mode. Select it, and close the menu.