确定Matlab加载的java类的位置 [英] Determine location of a java class loaded by Matlab

查看:66
本文介绍了确定Matlab加载的java类的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When using java from Matlab, is there some way to figure out from where in matlab's java class path is a class being loaded? I'm trying to diagnose a error caused by conflicting versions of the same class being used simultaneously.

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

Specifically, the class I'm looking for is org.apache.lucene.store.FSDirectory. It seems to be used by one of the matlab toolboxes, but I don't know which one.

推荐答案

来自 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/

这篇关于确定Matlab加载的java类的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆