How do you replace endorsed directory in Java 9?

keiki :

In Java 8 and prior there exists the mechanism to use an endorsed directory(java.endorsed.dirs), which is a collection of libraries which overrides JDK internal implementations.

How can I solve this in Java-9? As endorsed dirs where removed there?

Naman :

In JDK 9, you can use upgradeable modules or put the JAR files on the classpath.

The Java 9 migration guide states:

The java.endorsed.dirs system property and the lib/endorsed directory are no longer present. The javac compiler and java launcher will exit if either one is detected.

You would end up finding the error if any of these exists as :

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

These endorsed-standards override mechanism was removed to attain Modular Run-Time Images and would now use the modular image.

A modular image is composed of modules rather than JAR files. Going forward, endorsed standards and standalone APIs are supported in modular form only, via the concept of upgradeable modules.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=429779&siteId=1