Page 1 of 1

Could not initialize class org.opensim.modeling.opensimModel

Posted: Tue Nov 24, 2015 7:00 am
by clarabalust
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

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

Posted: Thu Nov 26, 2015 11:14 am
by jimmy
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

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

Posted: Thu Apr 27, 2017 5:12 am
by j_butzer
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

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

Posted: Thu Apr 27, 2017 6:11 pm
by tkuchida
"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.

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

Posted: Tue May 02, 2017 4:25 am
by j_butzer
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!

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

Posted: Tue May 02, 2017 3:06 pm
by tkuchida
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.

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

Posted: Fri May 05, 2017 5:48 am
by j_butzer
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!

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

Posted: Fri May 05, 2017 6:52 am
by mitkof6
Have you tried adding OpenSim to system path and not just to Matlab's path variable?

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

Posted: Sat May 06, 2017 2:24 am
by j_butzer
No I haven't tried that before. Thanks for this hint. Now it works :)