如何替换Java 9中的endorsed目录?

在Java 8和之前的版本中,存在使用支持目录(java.endorsed.dirs)的机制,该目录是覆盖JDK内部实现的库集合。

我怎样才能在Java 9中解决这个问题。在那里删除了被删除的dirs?

在JDK 9中,您可以使用可升级模块或将JAR文件放在类路径上。

Java 9迁移指南指出:

java.endorsed.dirs系统属性和lib/endorsed目录不再存在。 如果检测到任何一个, javac编译器和java启动器将退出。

如果存在以下任何一种情况,您最终会发现错误:

 /lib/endorsed is not supported. Endorsed standards and standalone APIs in modular form will be supported via the concept of upgradeable modules. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. 

删除了这些认可的标准覆盖机制以获得模块化运行时映像 ,现在将使用模块化映像。

模块化图像由模块而不是JAR文件组成。 outlook未来,通过可升级模块的概念,仅以模块化forms支持认可标准和独立API。

 I also faced same issue, Java versions higher than 8 are not supported by Tomcat 9. please check bin/catalina.sh for more information. #JAVA_ENDORSED_DIRS (Optional) Lists of of colon separated directories #containing some jars in order to allow replacement of APIs #created outside of the JCP (ie DOM and SAX from W3C). #It can also be used to update the XML parser implementation. #This is only supported for Java <= 8. #Defaults to $CATALINA_HOME/endorsed.