Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a jar to the boot classpath in java 9

In my application that runs on java 8, I am using -bootclasspath:p to add a jar to the boot classpath. In java 9, the option is removed. What is the alternative to do the same in java 9?

like image 518
Qwerty Avatar asked Jan 08 '18 10:01

Qwerty


People also ask

How do I find the classpath of a jar file?

To check our CLASSPATH on Windows we can open a command prompt and type echo %CLASSPATH%. To check it on a Mac you need to open a terminal and type echo $CLASSPATH.

How do you specify classpath in manifest MF?

By using the Class-Path header in the manifest, you can avoid having to specify a long -classpath flag when invoking Java to run your application. Note: The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over Internet protocols.


1 Answers

You may use -Xbootclasspath/a. Please refer to the release notes which states:-

The boot class path has been mostly removed in this release. The java -Xbootclasspath and -Xbootclasspath/p options have been removed.

The javac -bootclaspath option can only be used when compiling to JDK 8 or older. The system property sun.boot.class.path has been removed.

Deployments that rely on overriding platform classes for testing purposes with -Xbootclasspath/p will need to changed to use the --patch-module option that is documented in JEP 261.

The -Xbootclasspath/a option is unchanged.

like image 146
Anjana Avatar answered Oct 03 '22 20:10

Anjana