MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   确定Matlab加载的Java类的位置 (https://www.labfans.com/bbs/showthread.php?t=22729)

poster 2019-12-10 16:49

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

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


回答:
来自[URL]http://www.exampledepot.com/egs/java.lang/ClassOrigin.html[/URL]

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

[url=https://stackoverflow.com/questions/1127166]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 11:02

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.