如何获取部署在 WebLogic Server 中的 EAR 的类路径
我有一个在 WebLogic 10.3.2 版本中部署为 EAR 的应用程序。我正在研究一些实现,我必须扫描类路径中的所有 .jar 文件。
在运行时,当我调用 System.getProperty("java.class.path"); 时,它返回 WebLogic 引导类路径,而不是我的应用程序在 EAR 文件中使用的类路径。
有什么方法可以获取 EAR 文件正在使用的类路径吗?我的意思是它是在 META-INF/MANIFEST.txt 文件中定义的。
请提前告知并致谢。
拉吉
I have an application deployed as an EAR in WebLogic 10.3.2 version. I am working on some implementations where I got to scan all of the .jar files in classpath.
At Runtime, when i call System.getProperty("java.class.path");
, It returns me the WebLogic bootstrap classpath, NOT the one which my application is using within the EAR file.
Is there any way to the get the classpath which is being used by EAR file? I mean which is defined inside META-INF/MANIFEST.txt file.
Please advise and thanks in advance.
Raj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 this.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
或者,如果您需要加载内容,您应该查看
java.lang.ClassLoader.getSystemClassLoader();
和/或java.lang.Thread.currentThread().getContextClassLoader();
。You can use
this.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
Or, if you need to load stuff, you should take a look into
java.lang.ClassLoader.getSystemClassLoader();
and/orjava.lang.Thread.currentThread().getContextClassLoader();
.您不能使用 getClassLoader() 方法,并且需要在要访问的文件名之前提供“/”
You cannot use getClassLoader() method and need to provide the "/" before the file name you are accessing