Brief introduction to Java Prelude, background, JRE,JVM and program execution process

Source: Internet
Author: User

Long time No learning Java, to review the first chapter of Java.

First, characteristics-cross-platform principle

1. Classification of languages

1) Machine Language advantages: Direct operation, fast speed disadvantage: can not cross platform

2) C, C + + and other compiled languages

Using a specific compiler for a specific platform, the code is translated one time into the machine instructions that the platform can recognize and packaged as a file that the platform can recognize, can be run out of the development environment

Advantages: High Efficiency disadvantage: portability is not strong

3) Perl,basic and other explanatory languages

Use a dedicated interpreter to interpret the machine code instructions that the platform can recognize for a specific platform, and to interpret an article that performs a

Pros: Portability Good Disadvantage: code leakage, inefficient

Then the Java language is compiled interpreted language, the Java compiler translates the Java source code into bytecode instructions, and stored in the. class file, the runtime uses a specific Java compiler, the bytecode instructions translated into the corresponding machine code instructions, side translation side Execution

Java file----->java compiler----->.class file----->java interpreter------> platform (OS and hardware)

II. JRE

The JRE means the Java Runtime environment, including the Java class Library, the JVM, and some configuration files

is the JRE file in the installation directory, and the JDK file is the software Developer's Toolkit

Third, the JVM

The JVM virtual machine is a core part of the JRE, and the Java program must start when it contains the

1) Cpu:java Compiler

2) Stack Memory: Store basic type data and references

3) Heap Memory: Store objects (here I understand, like in a fish pond, fish pond as a heap, and then put fish in the pond, fish compared to objects)

4) Method Area: Store method definition and method body for each class

5) Garbage collector: reclaims garbage objects in heap memory

6) class loader, which is used to load the. class file, which is divided into three categories

i) load the classes necessary to run the JVM at once

II) Load API class

III) load the custom class

Iv. process of implementation

1) Loading bytecode files

2) Verifying the legality of byte code

3) Allocating and managing memory

4) Translate bytecode instructions

5) Garbage Collection

V. Environment variables

Variables defined in the OS for application access

View: Computer--Properties--Advanced system settings-environment variables

DOS window: set COMMAND + variable name

Space environment variable: SET COMMAND + variable name =

VI. PATH environment variable:

Define the path to the OS to find or run an executable file

If you are not familiar with DOS commands when setting environment variables, you can set directly in the computer--Properties--environment variables.

In general, a path variable is set directly (Java-jdk-bin the location of this file because there are java.exe,javac.exe programs in this file that we want to run when compiling and running Java files): (default) C:\Program Files\java\jdk1.6.0_13\bin

Of course, you can also set a CLASSPATH variable, through the path in this variable, the runtime can find the. class file, which defines the path (. Class) for the JVM to find or run the bytecode file

Run under DOS (not much attention here before, and then run with an absolute path after compiling)

Javac Java file path name

Java class name

and the. class file and Java files are stored separately in the Src,classes folder

DOS command javac-d path name: Specifies the path to the compiled. class file

That's what's in the first chapter, and then it's about writing a great program, Hello World!。。

Brief introduction to Java Prelude, background, JRE,JVM and program execution process

Related Article

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.