如何获取部署在 WebLogic Server 中的 EAR 的类路径

发布于 2025-01-06 12:54:08 字数 283 浏览 6 评论 0原文

我有一个在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蒗幽 2025-01-13 12:54:08

您可以使用 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/or java.lang.Thread.currentThread().getContextClassLoader();.

疑心病 2025-01-13 12:54:08

您不能使用 getClassLoader() 方法,并且需要在要访问的文件名之前提供“/”

this.getClass().getResource("/META-INF/MANIFEST.MF");

You cannot use getClassLoader() method and need to provide the "/" before the file name you are accessing

this.getClass().getResource("/META-INF/MANIFEST.MF");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文