确定Matlab加载的java类的位置

wei*_*yin 2 java matlab classpath

当使用Matlab中的java时,有没有办法弄清楚matlab的java类路径在哪里被加载?我正在尝试诊断由同时使用的同一类的冲突版本引起的错误.

具体来说,我正在寻找的类是org.apache.lucene.store.FSDirectory.它似乎被其中一个matlab工具箱使用,但我不知道哪一个.

Tho*_*sen 8

来自http://www.exampledepot.com/egs/java.lang/ClassOrigin.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/
Run Code Online (Sandbox Code Playgroud)