Adjusting MATLAB classpath file

692 views
Skip to first unread message

jtl

unread,
Mar 1, 2012, 2:06:34 PM3/1/12
to bcvtb
Hi Everyone,

I am trying to run another program from within MATLAB as part of my
bcvtb model and am running into issues with execution.

To have the other program (NETLOGO) run in MATLAB, it is necessary to
first run the following line of code in MATLAB:

>> import org.nlogo.headless.HeadlessWorkspace

It is also necessary to modify the MATLAB classpath.txt file, with the
following lines added:

# Java classpath for NetLogo
/Users/jaredlangevin/Downloads/NetLogo 4.1.3/NetLogo.jar
/Users/jaredlangevin/Downloads/NetLogo 4.1.3/lib

When I do this and run directly from MATLAB (i.e. open MATLAB, enter
that code, and run the file) it works just fine.

However, when I run MATLAB from the BCVTB, it gives me the following
error:

{ ??? Error using ==> import
Import argument 'org.nlogo.headless.HeadlessWorkspace' cannot be found
or
cannot be imported.

Error in ==> simulateAndExit_BASELINE_netlogo at 48
import org.nlogo.headless.HeadlessWorkspace
}
>>

I'm wondering why when I run in bcvtb it doesn't seem to recognize the
changes I made to the MATLAB classpath.txt file? I checked and the
bcvtb is opening the same version of MATLAB on my computer that I
modified the classpath.txt file for. Is there another file that needs
to be modified specifically for use with bcvtb?

Thanks in advance for the help!

Best,

Jared





jtl

unread,
Mar 1, 2012, 3:59:21 PM3/1/12
to bcvtb
Apologies- I had the -nojvm option set on the MATLAB simulator actor,
which wasn't enabling the import.

Thanks,

Jared

Homero Noboa

unread,
Mar 1, 2012, 5:29:57 PM3/1/12
to bc...@googlegroups.com
Can you run the BCVTB simulation without the -nojvm option? I thought we must set the option for successful BCVTB run.

Homero
--
Homero Noboa, Ph. D.

jtl

unread,
Mar 2, 2012, 8:35:38 AM3/2/12
to bcvtb
Homero,

You can run the simulation without that option. From what I have
read, this just tells MATLAB to run without the Java Virtual Machine,
which it uses to implement its GUI environment. Running the two
together can in some cases create memory problems.

In my case, I think the -nojvm option was preventing MATLAB from using
any tools that require Java (and thus it couldn't access Netlogo).

I'm certainly not an expert so if there is a better/more efficient way
to run Netlogo in MATLAB without disabling the -nojvm option, I would
love to know! I guess the two could be linked separately in the bcvtb
setup but it's just not as easy for me to manage...

Best,

Jared
Reply all
Reply to author
Forward
0 new messages