查看单个帖子
旧 2019-12-10, 16:49   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 确定Matlab加载的Java类的位置

在Matlab中使用Java时,是否有某种方法可以找出从matlab的java类路径中的哪个位置加载类?我正在尝试诊断由于同时使用同一类的版本冲突而导致的错误。

具体来说,我要查找的类是org.apache.lucene.store.FSDirectory。它似乎由matlab工具箱之一使用,但我不知道是哪一个。


回答:
来自http://www.exampledepot.com/egs/java...assOrigin.html

// Get the location of this class Class cls = this.getClass(); ProtectionDomain pDomain = cls.getProtectionDomain(); CodeSource cSource = pDomain.getCodeSource(); URL loc = cSource.getLocation(); // file:/c:/almanac14/examples/

更多&回答...
poster 当前离线   回复时引用此帖