Introduction to Java Virtual machines

Source: Internet
Author: User

Java Virtual machine definition Java Virtual machine has multi-layered meanings
    • Set of Specifications: Java Virtual machine specification. Defining the behavior of conceptually Java virtual machines

    • An implementation: For example, Hotspot,j9,jrockit. The JVM specification needs to be implemented, but it does not need to be implemented in the same way as a "concept" JVM.

    • A running instance, an instance of a run that is implemented by a JVM.

    • You can do this as long as you enter a class file that conforms to the specification. Java programs are not necessarily implemented and can be supported in other languages, such as Scala, Clojure, Groovy, Fantom, Fortress, Nice, Jython, JRuby, Rhino, Ioke, Jaskell, (C, Fortran)

JVM and JRE, JDK relationships

Jvm:java Virtual Machine is responsible for executing the code-compliant class file.

Jre:java runtime Environment, which contains the JVM and class libraries.

Jdk:java Development Kit, which contains the JRE and some development tools, such as Javac.

JVM instance and JVM execution engine instance

The JVM instance corresponds to a separate running Java program, while the JVM execution engine instance corresponds to the thread that belongs to the user running the program, that is, the JVM instance is the process level, and the execution engine is thread-level.

Basic structure of the JVM

Class loading Subsystem

The class loading of the JVM is done through ClassLoader and its subclasses, and the hierarchy and loading order of the classes can be described as follows:

    • Bootstrap ClassLoader is responsible for loading all the class libraries in the $java_home/jre/lib into memory, Bootstrap ClassLoader is the JVM level, implemented by C + +, not classloader subclasses, The developer cannot directly get a reference to the startup ClassLoader, so it is not allowed to operate directly from the reference.

    • Extension ClassLoader is responsible for loading some of the jar packages that extend functionality in the Java platform, mainly implemented by Sun.misc.launcher$extclassloader, is a Java class, Inherits from the URLClassLoader superclass. It will be responsible for loading the jar and class in the%jre_home/lib/ext directory into memory, and developers can use the loader directly.

    • The APP ClassLoader is responsible for loading the jar packages and directories specified in the environment variable classpath into memory, and developers can also use the system ClassLoader directly.

    • Custom ClassLoader belongs to the ClassLoader (subclass Java.lang.ClassLoader) that the application customizes according to its own needs during the program run, Dynamically loading class files through Java.lang.ClassLoader subclasses, embodying Java dynamic real-time class loading features, such as Tomcat and JBoss, will implement the ClassLoader on their own, according to the EE specification. Custom ClassLoader can be useful in some scenarios, especially when you need the flexibility to dynamically load class.

Introduction to Java Virtual machines

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.