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

 Réponse acceptée

Friedrich
Friedrich le 10 Août 2011

0 votes

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 commentaires

T
T le 10 Août 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 le 10 Août 2011
Of course, I had to edit classpath.txt...

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by