Configuration MATLAB/OpenSim - Error Java

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Juliet M
Posts: 8
Joined: Tue Feb 13, 2024 2:43 am

Configuration MATLAB/OpenSim - Error Java

Post by Juliet M » Thu Feb 29, 2024 4:09 am

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!

Tags:

User avatar
Deepak Singh
Posts: 6
Joined: Wed Feb 14, 2024 2:48 pm

Re: Configuration MATLAB/OpenSim - Error Java

Post by Deepak Singh » Thu Feb 29, 2024 8:54 am

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)

User avatar
Ayman Habib
Posts: 2235
Joined: Fri Apr 01, 2005 12:24 pm

Re: Configuration MATLAB/OpenSim - Error Java

Post by Ayman Habib » Thu Feb 29, 2024 2:02 pm

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

POST REPLY