SMILE and Matlab R2015a

The engine.
Post Reply
jakurucar
Posts: 1
Joined: Mon Aug 31, 2015 1:56 pm

SMILE and Matlab R2015a

Post by jakurucar »

Hello community.

I'm new to the community although I've been using SMILE (jSMILE wrapper) and GeNIe for a little while. I wanted to share my experience with getting SMILE (via jSMILE) to work with newer versions of Matlab. The current instructions on how to link the .jar and .dll in the wiki are no longer completely correct which caused me a great deal of frustration. To help others, I'd like to share how I was able to use SMILE in Matlab with more current releases.

The steps for the previous process are correct until you begin to add the .jar and .dll to the Matlab paths. The updates below assume the smile.jar and the jsmile.dll are located the directory "C:\Users\...\Documents\Java\". You can use any directory.

The .jar must be added via a .txt file in the Matlab preferences directory. You can determine this directory by executing the following Matlab command: "prefdir" This will tell you were to place the .txt file. This text file must be named "javaclasspath.txt' and is not created by default anymore. In this file, place the path to the .jar file (including the name and file extension). For example "C:\Users\...\Documents\Java\smile.jar". This will add the .jar to your Matlab static path upon start up.

The .dll is added in a similar way via a .txt file in the Matlab preferences directory (same as above). This .txt file must be named "javalibrarypath.txt" and should contain the path to the directory containing the .dll (not including the name and file file extension). For example "C:\Users\...\Documents\Java"

After a Matlab restart, you can verify that the .jar was added correctly by executing the following command in Matlab "javaclasspath". You should see the path to the .jar. To test the connection, simply try to create a new network object by running the following command "net = javaObject('smile.Network')" If you get an error it's most likely because the .jar or .dll are not linked appropriately.

I apologize if this is elsewhere; however, I wasn't able to find it while I was struggling with this. I hope it helps somebody out there. Lastly, for those using Matlab, there are inefficiencies in the example tutorial code for Matlab on the wiki. I'd be happy to discuss my approach using the jSMILE wrapper in Matlab if anyone is doing something similar.
cymytlds
Posts: 4
Joined: Tue Jun 13, 2017 10:13 pm

Re: SMILE and Matlab R2015a

Post by cymytlds »

I found I could not link with the newly updated jsmile.dll(jsmile_win64.zip, modified on Jun27 2016) and smile.jar(smile_vc14_x64.zip, modified on Mar25 2016). My system is win8 and my MATLAB is R2015b. I can link them with old ones by using the instruction wiki shows. I guess there is some problem in new files.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: SMILE and Matlab R2015a

Post by shooltz[BayesFusion] »

I found I could not link with the newly updated jsmile.dll(jsmile_win64.zip, modified on Jun27 2016) and smile.jar(smile_vc14_x64.zip)
jsmile.dll and smile.jar are both in jsmile_win64.zip. I'm not sure why are you referring to smile_vc14_x64.zip - do you want to recompile jSMILE?
cymytlds
Posts: 4
Joined: Tue Jun 13, 2017 10:13 pm

Re: SMILE and Matlab R2015a

Post by cymytlds »

No, I do not want to recompile it. I just could not call new jsmile with my matlab. The problem is solved. My labmate sent me the old smile zip file (including jsmile and smile). Thanks!
Post Reply