Java Virtual Machine 1: What is Java

Preface

Let's take a look at the advertising slogans of Java, from http://www.java.com/zh_CN/about/:

  • 97% of enterprise desktops run Java
  • 89% of desktops (or computers) in the United States run Java
  • 9 million Java developers worldwide
  • Developer's number one choice
  • The number one deployment platform
  • There are 3 billion mobile phones running Java
  • 100% of Blu-ray Disc players come with Java
  • 5 billion Java cards are in use
  • 125 million TV devices running Java
  • The top 5 OEMs all provide Java ME

Isn't it awesome? OK, behind this awesomeness, we Java developers have thought about what Java is that we spend day and night with us every day? Of course, the first reaction in many people's minds must be, isn't Java just a programming language, the language we write code every day. Of course, this is also correct, but Java actually includes a wider range, let's look at it together.

What is Java

After years of development, Java has evolved from a pure computer programming language to a powerful technical system. Yes, what is Java, I think the technical system should be the best summary. Java designers have divided Java into three structurally independent but mutually dependent technical system branches, which correspond to different sets of specifications and components:

  1. Java SE (Standard Edition), mainly active in the desktop field, mainly contains Java API components.
  2. Java EE (Enterprise Edition) is active in the enterprise-level field. In addition to including Java API components, it also includes Web components, transaction components, distributed components, EJB components, message components, etc. Combining these technologies, developers can build An enterprise-level application with high performance and rigorous structure, and Java EE is also the preferred platform for building SOA (Service Oriented Architecture).
  3. Java ME (Lite Edition), active in the embedded field, is called the Lite Edition because it only retains some of the components in the Java API and some unique components adapted to the device.

The above mentioned the branches of the Java technology system. Since Java is a technology system, let's take a look at the technologies that make up this technology system:

  1. Java programming language
  2. Bytecode
  3. Java API, including Java API class libraries and third-party class libraries from commercial organizations and open source communities
  4. Java Virtual Machine

Many times we only pay attention to the first point, because the first point is actually related to work. The content contained in the Java technology system actually provides us with a picture from the official Java system. The source of the picture is http://docs.oracle.com/javase/7/docs/

For more interview materials and video tutorials from major manufacturers, you can click to enter directly and get them for free! Password: CSDN

Advantages of Java

Java can be so widely recognized, in addition to its rigorous structure, object-oriented programming language, there are many advantages that cannot be ignored:

1. It gets rid of the shackles of the hardware platform and realizes "write once, run everywhere"
2. It provides a relatively safe memory management and access mechanism, avoiding most of the memory leaks and pointer out-of-bounds problems
3. It implements Hot code detection and runtime compilation and optimization, which enable Java applications to obtain higher performance as the runtime increases.
4. It has a complete set of application program interfaces, as well as countless articles from commercial organizations and open source communities. The tripartite class library helps it to achieve various functions.
5. Its inherent support for distributed technology is relatively complete.

However, the biggest advantage and wealth of Java is not the above. Just like the teacher Gao Xianglong wrote in "Java Virtual Machine", the real power of Java is because it has the most technical supporters and open source community support in the world. They maintain the most abundant physical strength and thinking all the time, driving the trend of Java technology step by step.

JDK和JRE

Two common important concepts. In fact, the above figure has divided the scope of JDK and JRE. Let's make a summary of this picture, and briefly summarize what JDK and JRE are in our language:

1. JDK (Java Development Kit) is the smallest environment used to support the development of Java programs. Basically, the three parts of Java programming language, Java virtual machine, and Java API class library form JDK
2. JRE (Java Runtime Enviroment), It is a standard environment that supports the running of Java programs. The Java SE API in the Java API library and the Java virtual machine form the JRE.

OpenJDK

As mentioned earlier, "Java is really powerful because it has the world's most technical supporters and open source community support, they maintain the most abundant physical strength and thinking all the time, step by step to drive the trend of Java technology." In fact, JDK was not open source at the beginning, but with the vigorous development of the open source movement, Sun announced in 2006 that it would open source Java, and the development of open source Java platform was mainly concentrated on the OpenJDK project. On April 15, 2009, Sun officially released OpenJDK. JDK 7 was the first version released after Java was open sourced. Any organization or individual can contribute to the development of Java. Of course, there is still a difference between OpenJDK and the real Oracle JDK (because Sun was acquired by Oracle in 2010, so it is called Oracle JDK):

The code in OpenJDK basically comes from Oracle JDK, which belongs to a branch of Oracle JDK, but some non-open source components and codes are removed and replaced with open source components and codes, mainly encryption and graphics. Therefore, there may be some incompatibility when using OpenJDK instead of Oracle JDK.

For those interested in OpenJDK, you can download the source code of OpenJDK on the OpenJDK official website http://download.java.net/openjdk/jdk7/. Like Java virtual machine HotSpot, Java compiler Javac, JNI, etc., the source code is inside.

JCP and JSR

JCP (Java Community Process) is a set of mechanisms for formulating Java technical specifications. It promotes the development of Java technical specifications by formulating and reviewing JSR (Java Specification Requests). For a submitted JSR to become the final state, it needs to undergo a formal public review and voted by the JCP committee. The final JSR will provide a reference implementation, which is free and open source code. JSR is not only managed by Oracle. Any individual can register and participate in the review of JSR. For those interested in the development of Java language, tracking the development of JSR is a good way to learn. You can view all JSRs on the JCP official website http://www.jcp.org/. Here are a few familiar JSRs:

  1. JSR 14, Generic
  2. JSR 51 , NIO
  3. JSR 175, annotation
  4. JSR 201, enumeration and automatic boxing, etc.
  5. JSR 221 , JDBC4.0 API

Java Virtual Machine

Finally, it's the big brother's turn to appear, and he will also be the protagonist of the following article. Why Java can achieve the so-called "write once, run everywhere" is mainly because of the existence of the virtual machine. The Java virtual machine is responsible for the security features and platform independence of the Java programming language. The Java virtual machine shields information related to a specific operating system platform, so that the Java language compiler only needs to generate bytecodes that run on the Java virtual machine, and it can run on multiple platforms without modification. The Java virtual machine frees Java from the constraints of specific machines and makes it possible to write programs across different platforms.

I want to mention one more thing. The Java virtual machines we are talking about are basically the virtual machine HotSpot that comes with the JDK. This virtual machine is also the virtual machine with the largest market share in the current commercial virtual machine. You can enter it in the command line program "Java -version" to view.

In fact, there are many other excellent virtual machines on the market. In addition to the famous HotSpot, Sun also has KVM, Squawk VM, Maxine VM, BEA has JRockit VM, IBM has J9 VM and so on.

postscript

The more you learn the Java Virtual Machine, the more interesting you find it, and the more complicated, weird and unsolvable problems can be solved in your work (Why are you better than others, why are you getting higher wages than others? To put it bluntly, you can Can you solve problems that others can't solve, and do things that others can't do?). Or, when a Java project is huge to a certain extent, it will customize its own virtual machine according to its own business needs. For example, Taobao.com has deeply customized Taobao VM based on OpenJDK. The basis for this is to virtualize Java. Machine has a deep understanding. As a Java development, if the goal is to write code well, then OK, there is no need to learn or research anything other than the Java language. For each company, you only need to simply understand the overall structure and rationale of the company’s project. Just clear the business. But if the goal is to become a Java technology expert, CTO, and believe that code can change the world (at least I am working in this direction), then learning and researching virtual machines is definitely an indispensable lesson.

Reader benefits

Thank you for seeing here!
I have compiled a lot of 2021 latest Java interview questions (including answers) and Java study notes here, as shown below

Insert picture description here

The answers to the above interview questions are organized into document notes. As well as interviews also compiled some information on some of the manufacturers & interview Zhenti latest 2021 collection (both documenting a small portion of the screenshot) free for everyone to share, in need can click to enter signal: CSDN! Free to share~

If you like this article, please forward it and like it.

Remember to follow me!
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_49527334/article/details/115054903