3

Is there a way to ignore the -Xbootclasspath/p flag inside the java command line with Java 11 withoiut removing it such that the same command line can be used for Java 8 and Java 11? The command line I am using is the following with ALPN.

java -Xbootclasspath/p:/.m2/repository/org/mortbay/jetty/alpn/alpn-boot/8.1.12.v20180117/alpn-boot-8.1.12.v20180117.jar -jar the-bundle.jar

I get the following error.

-Xbootclasspath/p is no longer a supported option.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I already tried -XX:+IgnoreUnrecognizedVMOptions without success (I get the same error).

Nicolas Henneaux
  • 9,769
  • 10
  • 44
  • 71
  • Ideally, you should be replacing the VM argument. What doesn't work with `-XX:+IgnoreUnrecognizedVMOptions`? Please share the error. Related - https://stackoverflow.com/questions/48148607/how-to-add-a-jar-to-the-boot-classpath-in-java-9 – Naman Jan 10 '19 at 10:45
  • I have added the error. It doesn't change the behavior when adding `-XX:+IgnoreUnrecognizedVMOptions` before or after `-Xbootclasspath/p:`. – Nicolas Henneaux Jan 10 '19 at 11:16
  • This looks a patch to add ALPN to JDK 8, I assume it makes no sense to attempt to patch JDK 9 or newer as the support is built-in. – Alan Bateman Jan 10 '19 at 13:31
  • I totally agree ALPN is not needed anymore for Java 9+. However I would like to keep the command line compatible with Java 8 and Java 9+. It would be nice the parameter is just ignored instead of crashing the JVM. – Nicolas Henneaux Jan 10 '19 at 13:40

0 Answers0