Clash with existing Jar files

I am using Matlab R2011a The following code works because the ImmutableList of Google is contained in some jar file listed in JavaClasspath
>> import com.google.common.collect.ImmutableList;
>> w = ImmutableList.of('Hans','Wurst')
My program is a Java project that is also using ImmutableLists. However, I am using version more uptodate. how can I find out what version Matlab is using? How can I determine which jar file is hiding the ImmutableList? How can I enforce Matlab to rank my jar file higher?
Best regards Thomas

 Accepted Answer

Hi,
the jar file containing the ImmutablesLists is:
C:\Program Files\MATLAB\R2011a\java\jarext\google-collect.jar
I think there is no way to force MATLAB to rank your file higher. The only way I see it to remove this jar from the JavaClasspath and add yours. But I wont recommend this since this can lead to MATLAB crashes and/or strange behavior.

2 Comments

T
T on 10 Aug 2011
Friedrich, thanks for your quick reply
I added an updated guava.jar (google-collect has been retired a while ago) and deleted google-collect.jar. I find it really irritating that MathWorks is producing such a mess with like 300 jar files even in the basic installation. I suggest them to rename the external jar files, e.g. instead of com.google.... they should rename them to com.mathworks.google...
This will remove quite some pain integrating Java tools for me.
Thomas
T
T on 10 Aug 2011
Of course, I had to edit classpath.txt...

Sign in to comment.

More Answers (0)

Asked:

T
T
on 10 Aug 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!