Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Oracle themselves have a little snippet page on how it works <a href="http://www.oracle.com/technetwork/java/security-136118.html" rel="nofollow noreferrer">here</a>.</p> <p>Basically, the JRE doesn't trust the JDK. That's because it has no knowledge of which JDK compiler created the class file. It treats the class file as hostile until verified.</p> <p>Expanding on that, the bytecode verification is a necessary step to protect from what Sun call a "hostile compiler". Sun's own Java compiler ensures that Java source code doesn't violate the safety rules but, when an application imports a code fragment, it doesn't actually <em>know</em> if the code fragment follows Java language rules for safety. In other words, the code may not have been produced by a trustworthy Java compiler.</p> <p>In that case, the Java run time system on your machine has to assume the fragment is bad and subjects it to bytecode verification.</p> <p>The Java virtual machine does not even <em>see</em> the bytecode until it's been through this verification process. Doing this as the bytecode is loaded also has the advantage that a whole lot of run time checks don't need to be performed every time the code is executed. Because it's been verified as correct, it can, once it starts running, run faster than would otherwise be possible.</p> <p>A rendition of the linked diagram is below:</p> <pre><code> &lt;&lt;&lt;=== Unsafe / Safe ===&gt;&gt;&gt; \ +---------------+ +-------------------+ | Java source | +--&gt; | Class loader | --+ +---------------+ | | Bytecode verifier | | | | +-------------------+ | V | / | +---------------+ | \ V | Java compiler | Network / +-------------------+ +---------------+ | \ | JVM/JIT | | | / +-------------------+ V | \ | +---------------+ | / V | Java bytecode | --+ \ +-------------------+ +---------------+ / | Operating system | \ +-------------------+ / | \ V / +-------------------+ \ | Hardware | / +-------------------+ \ &lt;&lt;&lt;=== Unsafe / Safe ===&gt;&gt;&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload