Do you have access to Matlab to try some experiments? It seems that the
current working directory may be included by default in the dynamic path.
But, given that the paths in the classpath are absolute I think this must
mean the startup directory from which Matlab was launched. Could you open
a brand new instance of Matlab and run 'javaclasspath' and report the
output.
Also, the documentation seems to imply that every time the dynamic path is
modified ALL java objects are cleared. Can you test that?
Sample Code:
clear all
x = javaObject ('java.lang.StringBuffer', 'Hello World')
whos
javaaddpath ('/tmp')
whos
r2012a:
clear all
x = javaObject ('java.lang.StringBuffer', 'Hello World')
x =
Hello World
whos
Name Size Bytes Class Attributes
x 1x1 java.lang.StringBuffer
javaaddpath ('c:\temp')
whos
Name Size Bytes Class Attributes
x 1x1 java.lang.StringBuffer
so javaadpath leaves Java objects untouched.
Which IMO is entirely reasonable. I really can't see why adding something
to a PATH would clear objects.
Straight quote from the documentation,
"The functions javaaddpath and javaclasspath(dpath) add entries to the
dynamic class path. To avoid the possibility that the new path contains a
class or package with the same name as an existing class or package, MATLAB
clears all existing global variables and variables in the workspace."
And from javaaddpath,
"MATLAB calls the clear java command whenever you change the dynamic path."
So, it's possible that they don't mean what they say. Or maybe the example
I gave was somehow too simple. I guess we won't bother with compatibility
in this case.