如何在Java 11中将jar添加到引导类路径 [英] How to add a jar to the boot classpath in java 11

查看:154
本文介绍了如何在Java 11中将jar添加到引导类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行于Java 8的应用程序中,我使用了使用org.jboss.logmanager.LogManager的第三方库,因此我在启动类路径中添加了此jar,并且运行良好.但是,当迁移到Java 11时-Xbootclasspath/a或-Xbootclasspath/p无法正常工作,并且我无法启动我的应用程序.

In my application which is running on Java 8 I used third party library which is using org.jboss.logmanager.LogManager So I added this jar in bootclass path and it works fine. But when migrate to java 11 either -Xbootclasspath/a or -Xbootclasspath/p is not working and I can not start my application.

set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:D:/wildfly-10.1.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.0.4.Final.jar

我发现了如何添加在Java 9的启动类路径中添加一个罐子.但它不适用于Java 10或11. 谁能帮我吗?

I found How to add a jar to the boot classpath in java 9 answer. But it is not working for java 10 or 11. Can anyone please help me?

推荐答案

我尝试了以下操作:

(1)对我来说,将 -Xbootclasspath/p替换为 -Xbootclasspath/a-不起作用

(1) For me replacing -Xbootclasspath/p with -Xbootclasspath/a - Did not work

(2)然后我尝试删除整行,因为这是其他人的建议 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p: <path_to_jboss_logmanager>/jboss-logmanager-<version>.jar -没有用

(2) Then I tried to remove the whole line as this has been suggested by others -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p: <path_to_jboss_logmanager>/jboss-logmanager-<version>.jar - Did not work

(3)然后,我-Djboss.modules.system.pkgs= org.jboss.logmanager "中删除了日志管理器,然后它起作用了

(3) Then I also removed the logmanager from -Djboss.modules.system.pkgs=org.jboss.logmanager" and then it worked!

所以只有2 + 3的组合才有效.

So only the combination of 2+3 finally worked.

这篇关于如何在Java 11中将jar添加到引导类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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