Profile Image
vishnupriya

What is Java Bytecode Verification: -Xverify:all, -Xverify:remote, -Xverify:none?

What is Java Bytecode Verification: -Xverify:all, -Xverify:remote, -Xverify:none? 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

  • Java Bytecode Verification

  • -Xverify-all

  • -Xverify-remote

  • Xverify-none

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:


• -Xverify:remote
• -Xverify:all
• -Xverify:none


Description:


The -Xverify argument is used to control the verification of bytecodes, i.e. Java
.class files, when they are first loaded. The verification performed by the JVM
is described in the JVM Specification, section 4.10: Verification of class Files.


When -Xverify:remote is used, the JVM verifies all bytecodes except for those
loaded by the bootstrap classloader, i.e the JDK core library supplied by rt.jar,
which is presumptively valid. In practice this means that the JVM verifies all
application bytecodes. This is also the default behaviour if no -Xverify option
is specified.


When -Xverify:all is specified, all bytecodes including those loaded by
the bootstrap classloader are verified. This argument should be used if
-Xbootclasspath/a has been used to append classes to the bootstrap classpath.
However, using this option will tend to make the JVM startup time slightly
slower.


Using -Xverify:none turns off all verification of bytecodes. This is not recommended as it could cause the JVM to execute invalid bytecode, potentially
causing a JVM crash or unexpected behaviour. Additionally the -Xverify:none
option is deprecated since Java 13, and may be removed altogether in a future
version. If used in Java 13 or higher, a warning is printed at startup.


The -noverify argument is equivalent to -Xverify:none.


Default Value:


The default value of -Xverify is remote, i.e. verify all bytecodes not loaded by
the bootstrap class loader.


Errors:
When -Xverify:none is used on Java 13 or higher, the following warning is
printed:
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.


Arguments Related to -Xverify:


TODO: Link to -Xbootclasspath

 

Related Posts:


• Java Virtual Machine Specification 4.10: Verification of class Files.


NOTE:


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

  • Java Bytecode Verification

  • -Xverify-all

  • -Xverify-remote

  • Xverify-none