Error "initialize class" on Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Thomas Lagoute
Posts: 1
Joined: Fri May 20, 2022 12:39 am

Error "initialize class" on Matlab

Post by Thomas Lagoute » Thu Jun 02, 2022 8:49 am

Hello,

I am working with IMU and EMG and I try to convert .c3d files in suitable files for OpenSim by using Matlab r2022a.

When I run "configureOpenSim", it shows that the installation succeed. Yet, when I test
org.opensim.modeling.opensimCommon.GetVersion() , I get the following error message :

Failed to load one or more dynamic libraries for OpenSim.
java.lang.UnsatisfiedLinkError: C:\OpenSim 4.3\bin\osimJavaJNI.dll: Can't find dependent libraries
Make sure OpenSim's bin directory is on your PATH.
See https://simtk-confluence.stanford.edu/d ... ith+Matlab
Java exception occurred:
java.lang.UnsatisfiedLinkError: org.opensim.modeling.opensimCommonJNI.swig_module_init()V

at org.opensim.modeling.opensimCommonJNI.swig_module_init(Native Method)

at org.opensim.modeling.opensimCommonJNI.<clinit>(opensimCommonJNI.java:3149)

at org.opensim.modeling.opensimCommon.GetVersion(opensimCommon.java:25)


Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class org.opensim.modeling.opensimCommonJNI

at org.opensim.modeling.opensimCommon.GetVersion(opensimCommon.java:25)


I post my question here as I did not manage to find any further information elsewhere. I checked the path; the "bin" and "Utilities" folders are already in. I uninstalled Matlab 2021 which had the same error.

Thanks for your time and consideration.
Thomas

Tags:

User avatar
Thomas Uchida
Posts: 1808
Joined: Wed May 16, 2012 11:40 am

Re: Error "initialize class" on Matlab

Post by Thomas Uchida » Fri Jun 03, 2022 5:46 am

If you had OpenSim 3.3 installed, you may need to remove the OPENSIM_HOME environment variable. You could also check the Matlab path. A similar issue was reported and resolved in Topic 9993: viewtopicPhpbb.php?f=91&t=9993

User avatar
Junxiang Wang
Posts: 1
Joined: Wed Dec 11, 2024 2:41 am

Re: Error "initialize class" on Matlab

Post by Junxiang Wang » Wed Dec 11, 2024 4:40 am

Is your problem solved? I have the same problem

User avatar
hu hu
Posts: 15
Joined: Fri Jun 23, 2023 1:50 am

Re: Error "initialize class" on Matlab

Post by hu hu » Sat Dec 14, 2024 3:54 am

I have been unable to call OpenSim through MATLAB. I have confirmed that OpenSim's environment variables are correctly set, and I can run OpenSim via the CMD command line. However, I cannot identify the reason for this issue.
>> build_and_simulate_simple_arm

>> build_and_simulate_simple_arm
Failed to load one or more dynamic libraries for OpenSim.
java.lang.UnsatisfiedLinkError: D:\OpenSim 4.5\bin\osimJavaJNI.dll:
Make sure OpenSim's bin directory is on your PATH.

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:840)

User avatar
Ziyu Chen
Posts: 8
Joined: Tue Feb 16, 2021 11:15 am

Re: Error "initialize class" on Matlab

Post by Ziyu Chen » Mon Mar 10, 2025 10:23 pm

Found a fix (credit to Dr. Fregly @https://www.simtk.com/plugins/phpBB/vie ... 37&p=12641):
In system PATH environment variable, move [OPENSIM_INSTALL_DIR/bin] to the very top.

To be precise, it needs to be "high" enough (this is why newly added PATH variable won't work).
On my machine:
  • C:\Windows\system32
  • C:\Windows
  • C:\Windows\System32\Wbem
  • C:\Windows\System32\WindowsPowerShell\v1.0\
  • C:\Windows\System32\OpenSSH\
  • C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
  • ------works if [OPENSIM_INSTALL_DIR/bin] is here or above------
    ------otherwise gets "java.lang.UnsatisfiedLinkError"------
  • C:\Users\chenz\AppData\Local\Microsoft\WindowsApps\python.exe
  • D:\MATLAB\R2022a\runtime\win64
  • D:\MATLAB\R2022a\bin
  • D:\MATLAB\R2018b\runtime\win64
  • D:\MATLAB\R2018b\bin
  • .....
No idea why this would happen. Perhaps the team might want to look into this.

POST REPLY