Could not initialize class org.opensim.modeling.opensimModel

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Clara Balust
Posts: 3
Joined: Mon Oct 05, 2015 10:21 am

Could not initialize class org.opensim.modeling.opensimModel

Post by Clara Balust » Tue Nov 24, 2015 7:00 am

Dear all,
I keep getting this error when scripting with matlab:
"Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class org.opensim.modeling.opensimModelJNI"

I am using both Opensim and Matlab on a Mac through parallels and both are 32 bit, same for Java.

I have Opensim version 3.2 and 3.3 but I'm currently working with 3.2.

Any suggestions?
Thanks

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Could not initialize class org.opensim.modeling.opensimM

Post by jimmy d » Thu Nov 26, 2015 11:14 am

Hi Clara,

have you set uo your environment and Matlab paths correctly? There are some setup instructions here.

You may also need to change the admin privileges on your machine. A previous thread on that can be read here.

Let us know how it goes
-James

User avatar
Janek Butzer
Posts: 5
Joined: Tue Apr 18, 2017 3:05 am

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Janek Butzer » Thu Apr 27, 2017 5:12 am

Dear all,

I just started using OpenSim and was trying to use the matlab scripting for the DynamicWalker tutorial.
I run both Matlab and OpenSim as 64bit versions. I did the setup according to the setup instructions ("Scripting with matlab") and got no error when typing "model = org.opensim.modeling.Model();". Furthermore I get to see all methods in an OpenSim class when typing "methods Model" and all all method signatures in an OpenSim class when typing "methodsview Model".
But when I try to run the "OpenSimCreateTugOfWarModel.m" the following error occurs:

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

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

Any suggestion what I need to do to solve the problem?
Thanks!
Janek

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

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Thomas Uchida » Thu Apr 27, 2017 6:11 pm

"NoClassDefFoundError" is thrown when MATLAB is unable to find the necessary runtime libraries (see https://www.mathworks.com/matlabcentral ... -fx-button). If you're using Windows, the first thing you can verify is that the "OpenSim\bin" folder appears in your Windows PATH.

I would then suggest trying the "Manual Setup" instructions on the "Scripting with Matlab" Confluence documentation page (http://simtk-confluence.stanford.edu:80 ... ith+Matlab). Don't forget to restart MATLAB at the end.

User avatar
Janek Butzer
Posts: 5
Joined: Tue Apr 18, 2017 3:05 am

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Janek Butzer » Tue May 02, 2017 4:25 am

Thanks for your quick response. Unfortunatly the error still occurs although I went through the steps described in "manual setup". Furthermore to make sure that there is nothing missing in the matlab software package I installed Matlab R2017a and went through the manual setup with this release as well but this changed nothing.
Any ideas how to proceed?
Thanks a lot for your help!

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

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Thomas Uchida » Tue May 02, 2017 3:06 pm

Any ideas how to proceed?
Not with the information I have. Do all example scripts fail or just the one you mentioned? What operating system are you using? You mentioned that "I run both Matlab and OpenSim as 64bit versions." Does that mean that you installed 64-bit versions? You can check which OpenSim version you installed by opening <OpenSim installation directory>\sdk\buildinfo.txt.

User avatar
Janek Butzer
Posts: 5
Joined: Tue Apr 18, 2017 3:05 am

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Janek Butzer » Fri May 05, 2017 5:48 am

The operating system I'm using is Win7 64bit. Furthermore I use Matlab 2017a (64bit) and OpenSim 3.3 (64bit).
I've attached some screenshots which show the errors that occour and also the matlab search path.
Depending on the "(line ...)" shown in the error-message that causes the problem I think it's always the "model = Model(); function.
What other information can I provide that might be useful?
Thank you for your time and your help!
Attachments
Opensim_Matlab_04.JPG
Opensim_Matlab_04.JPG (89.42 KiB) Viewed 562 times
Opensim_Matlab_03.JPG
Opensim_Matlab_03.JPG (74.51 KiB) Viewed 562 times
Opensim_Matlab_02.JPG
Opensim_Matlab_02.JPG (20.95 KiB) Viewed 562 times
Opensim_Matlab_01.JPG
Opensim_Matlab_01.JPG (54.06 KiB) Viewed 562 times

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Dimitar Stanev » Fri May 05, 2017 6:52 am

Have you tried adding OpenSim to system path and not just to Matlab's path variable?

User avatar
Janek Butzer
Posts: 5
Joined: Tue Apr 18, 2017 3:05 am

Re: Could not initialize class org.opensim.modeling.opensimModel

Post by Janek Butzer » Sat May 06, 2017 2:24 am

No I haven't tried that before. Thanks for this hint. Now it works :)

POST REPLY