Profile Image

What is Java Boot Class Path: -Xbootclasspath?

 What is Java Boot Class Path: -Xbootclasspath? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xbootclasspath

  • bootclasspath

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky


• -Xbootclasspath/a:

• -Xbootclasspath/p: (unsupported in Java 9 and above)

• -Xbootclasspath: (unsupported in Java 9 and above)

where<paths> is a list of directories, JAR files and/or ZIP files. The list is separated by semicolons (;) on Windows and colons (:) on UNIX and UNIX-like operating systems.



UNIX and UNIX-like operating systems:
java -Xbootclasspath/a:/Users/jsmith/extra.jar:/Library/JavaExtra/ -jar application.jar
-java "-Xbootclasspath/a:C:\Program Files\JavaExtra\;C:\AppData\extra.jar" -jar app



The boot class path is the set of classes that are loaded by JVM’s boot class
loader, which is the parent of all other class loader and always has the first
chance to load any class. This normally means that the application cannot
provide classes with the same names as those from the core JDK library, which
includes packages such as java.lang and java.util. This constraint is crucial
for consistent and compatible behaviour of the Java runtime.

The -Xbootclasspath argument with its three variants are used to add to or
modify the set of classes loaded by the boot class loader. -Xbootclasspath/a
appends additional libraries to the end of the boot class path, and this is
the only variant of the argument that is still supported on Java 9 and above.
-Xbootclasspath/p prepends libraries to the beginning of the boot class path
and -Xbootclasspath (i.e. without either /a or /p) is used to replace the entire
boot class path. These latter two options are no longer available in Java 9 and

Prior to Java 9, it was possible to override or replace classes in the core JDK
library with -Xbootclasspath/p or -Xbootclasspath. For example if a developer wanted to provide a custom implementation of java.lang.String then,
ignoring the dangers this would entail, they could build a JAR containing the
custom implementation and prepend it to the boot class path with:

Note that prepending is necessary in this scenario because Java class loaders
always use the first implementation found for a class on the class path. With this
technique it is possible to add or replace classes in the JDK library, but not to
remove any. In order to remove classes it is necessary to replace the entire boot
class path using -Xbootclasspath. For the same reason, appending a library
to the boot class path with -Xbootclasspath/a cannot override any class from
the JDK library, because the built-in class will be read first.

WARNING: Deploying an application that replaces one or more classes in the
boot class path may be a violation of the Java binary code license. Seek your
own legal advice before deploying any such application

On Java 9 the -Xbootclasspath and -Xbootclasspath/p options were removed.
Therefore it is only possible to append classes to the boot class path using
-Xbootclasspath/a. The supported alternative for these removed options is
to use the --patch-module option to modify one or more modules in the boot

Given the limitations noted above with appending classes, the -Xbootclasspath/a
option is no longer very useful on Java 9 and above. It could be used for
example to force an Application Server (e.g. a Java EE Web Servlet container)
and all its contained applications to use a single preferred implementation of a
class rather than an implementation of their own choice.


Default Value:

The default value of -Xbootclasspath/a and -Xbootclasspath/p is an empty
The default value of -Xbootclasspath (on Java versions that support it) is the
rt.jar library shipped with the JVM installation, plus other libraries that may
be provided by the JVM vendor.



If -Xbootclasspath or -Xbootclasspath/p are used on a Java version where
they are not available, an error is printed and the JVM exits with an error code:
-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.
-Xbootclasspath is no longer a supported option.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


Arguments Related to -Xbootclasspath:

TODO: link to –patch-module


Related Posts

• Microsoft documentation on transitioning from Java 8 to Java 11.


If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xbootclasspath

  • bootclasspath