Working with Matlab R2016b
Closed this issue · 5 comments
I've recently upgraded from Matlab R2015b to R2016b and javaplex no longer seems to work. Specifically, when I run the tutorial's suggestion of "api.Plex4.createExplicitSimplexStream()" I get the error
Undefined variable "api" or
class
"api.Plex4.createExplicitSimplexStream".
My java version is 1.7, so I don't think it's that. Is there anything else I can try?
Hi Henry,
Many thanks for the quick reply.
I hadn't changed any of the lines or paths in those commands and I hadn't moved any folders, so everything should be in the right place.
However, I downloaded "matlab-examples-4.2.5.zip" and unzipped it to a fresh folder and ran it through 2016b, but still the same problem. The load_javaplex is in the same folder as all of the other folders such as utility and lib, so there should be no problem there. Further, I ran "javaclasspath('-dynamic')" and it seems that both paths are loaded properly.
Any further help would be gratefully received.
Hi Thomas,
I'm not sure what the answer to your question is. Thanks for the pointer to "javaclasspath('-dynamic')" --- this is a nice way (which I didn't know about) to confirm you've added the right paths. I will forward your email (and CC you) to some of the other Javaplex maintainers to see if they have any ideas.
Best, Henry
I'm not sure why, but Matlab 2016b seems more finicky than it used to be about how to refer to things. By using the full package name, I can make things work easily, so use
edu.stanford.math.plex4.api.Plex4.createExplicitSimplexStream()
instead works for me. This is unwieldy and gets annoying quickly, so the next thing I'd suggest is that by doing
import edu.stanford.math.plex4.api.Plex4;
you get access to the API Java object. Hopefully this gets you to where you can work at all with the package.
ETA
When revisiting, I manage to get everything working exactly as I expect it to. The following code:
javaaddpath('/Users/mik/Development/javaplex.new/dist/javaplex-4.2.5.jar');
import edu.stanford.math.plex4.*;
api.Plex4.createExplicitSimplexStream()
gets the response
ans =
edu.stanford.math.plex4.streams.impl.ExplicitSimplexStream@78ab88e9
from Matlab.
Henry: Weeell, not quite. After entering
import edu.stanford.math.plex4.api.Plex4;
you now have access to Plex4
as a variable, so you could use
Plex4.createExplicitSimplexStream()
However, as I noted in my update, importing just as we are telling users to do in the documentation, and in the load_javaplex.m
file, by running
import edu.stanford.math.plex4.*;
you get access to commands on the shape of api.Plex4.createExplicitStream()
et c.
As for debugging suggestions: make sure your class files are exactly where they need to be. Look at javaclasspath
to see that your javaplex jar file is listed there. Matlab likes to suggest you add classpaths directly to the Java preferences by editing a file called javaclasspath.txt
. If this sounds familiar, maybe Matlab changed or removed your javaclasspath.txt
when you updated?
I can't reproduce your problems. If you have more information to help us help you, feel free to reopen this bug.
I have added a new version of Javaplex, version 4.2.6, which should now easily support installation with Matlab 2016. The tutorial instructions have been updated as well. Please let me know if you have any trouble running Javaplex in newer versions of Matlab!
For the experts, the changes I made are as follows (as suggested by michiexile above):
(1) In load_javaplex.m, I commented out line 4 which said
clear import;
but now says
% clear import;
(2) After running load_javaplex.m, type
import edu.stanford.math.plex4.*;
into the Matlab command window.