Page 1 of 1

Configuration MATLAB/OpenSim - Error Java

Posted: Thu Feb 29, 2024 4:09 am
by manon5683
Hello there,

I tried to configure OpenSim with MATLAB, thus I carefully followed the instructions here: https://simtk-confluence.stanford.edu:8 ... ith+Matlab

On my script, I coded the following lines at the beginning:
import org.opensim.modeling.*
opensimLibPath = 'C:\Users\Manon JAMET\Desktop\OpenSim 4.4\sdk\';
javaaddpath(opensimLibPath);

I obtain the following error:
Error using PlotOpenSimwithMATLAB (line 20)
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_0()J

at org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_0(Native Method)

at org.opensim.modeling.Model.<init>(Model.java:804)

The strange thing is that sometimes, my script seems to work, I don't have this error each time (but maybe 90% of the time).

Please, have you a solution?
I have MATLAB 64bits and OpenSim 4.4.

Thank you in advance!

Re: Configuration MATLAB/OpenSim - Error Java

Posted: Thu Feb 29, 2024 8:54 am
by deepaksingh
Hi there,
I am facing the same issue in OpenSim 4.3. As you mentioned it works sometimes and then doesn't work most of the time. My Issue looks like this:

Code: Select all

Error using AddGeometryToOSIMModel (line 18)
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_1(Ljava/lang/String;)J

	at org.opensim.modeling.opensimSimulationJNI.new_Model__SWIG_1(Native Method)

	at org.opensim.modeling.Model.<init>(Model.java:821)

Re: Configuration MATLAB/OpenSim - Error Java

Posted: Thu Feb 29, 2024 2:02 pm
by aymanh
Hello,

While the steps to hookup Matlab with OpenSim are a bit error prone, once you have it working it should continue to work. There are a couple issues though that you have to keep an eye on:
1. What version of OpenSim you used to perform the hookup? you generally can't change the version or the path to the OpenSim libraries without unhooking the previous version. Due to the fact that (at least on windows) the common/global PATH environment variable is used to locate the OpenSim libraries, only one specific version can be specified.
2. Which user/profile is using Matlab? Matlab tries to keep setting files for different users separate. You could be on the same machine but using different users/profiles, or possibly using admin account when installing/hooking-up and a regular user account when it fails.

Hope this helps,
-Ayman