01 - Java language and development environment Overview of the most appropriate entry Java Tutorial

Java programs run mechanism

Compiled language :

Use special compiler for a specific platform ( operating system ) to a certain high level language source code disposable " turn translated " into machine code that can be executed by the platform hardware ( including machine instructions and operands ) , and packaged into the platform enforceability can identify the format of the program, the process is called compiling CCompile) . Enforceability of the program can be compiled from a development environment, in particular run independently on the platform. For example : C , C ++ , in Objective-C , Swi bit, Kotlin and other high-level language are all compiled language.  

Interpreted language :

It refers to the use of specialized interpreters for language source code into machine code line by line explanation of a specific platform and immediately executed. Interpreted languages do not normally compiled and linked processing integrity, the compiled interpreter language equivalent compiled language interpretation process and mixed together simultaneously with the completion. For example : JavaScript , Ruby , Python

 Java operating mechanism and procedures JVM

Java compiled into class files, and then explain the implementation of java class files through an interpreter, after compiled, interpreted in two steps, so pure Java language is neither compiled language, nor is it purely interpreted language.

JVM

Java language is responsible interpreted bytecode file is a Java virtual machine, namely NM (Java Virtual Machine), is cross-platform.

 

Install JAVA

Log in, download

Open the following pages:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Select jdk version download, select the version 11, version 11 is large, the latter .0.4 small version, large version of the can, a small version of it does not matter

Download will be prompted to login, use the following account and password:

[email protected]

Password: Oracle123

 

You can also directly open

https://www.oracle.com/technetwork/java/javase/archive-139210.html

 

Or download

Link: https: //pan.baidu.com/s/1iShAXioOUZ2Qt_cAWB0n7A

Extraction code: 89el

start installation

Next click on the downloaded file to the next step

At this point, the installation is complete.

3, configure the environment variables. (Because jdk11 version is more powerful than before, easier to use, so the configuration process is more streamlined. Less than before the class path configuration variables)

 New JAVA_HOME variable, and enter the installation directory JDK11.

Edit Path variable to% JAVA_HOME% \ bin; this variable is inserted. (Note win7 and win10 system editor to insert a new variable is not the same. But we must pay attention to see whether the final input.)

At this point the installation is complete.

Java entry - write and run the first program

Abstract: This paper describes how to use the Java language and through DOS simple program to run.

Write simple programs

In D the disc to create a new text document, enter the following code:

public class Hello {

public static void main(String[] args) {

System.out.println("Hello World");

}

}

 

Save and modify the file name and the suffix "Hello.java" .

Compile and run

Black window open command prompt, by simultaneously pressing the "Win + R" key to open operation, input cmd and press Enter to open.

Enter the command prompt window open in the "D:" and press Enter, enter D directory where the disk:

Enter "javac Hello.java" and press Enter.

Description: the javac command is used to compile the commands, which can be written by the programmer source files ( .java ) file compiled into bytecode ( .class ).

At this point, you will find in D footwall more called "Hello.class" file, which is javac bytecode files produced by the compiler.

Enter "java Hello" and press Enter.

Description: Java command is used to interpret and execute the command, it can be interpreted byte code files ( .class ) and execute the code.

After pressing the Enter key will have a "Hello World" is displayed to indicate successful execution.

 

 

 

 

 

 

 

 

 

 

 


 

Guess you like

Origin www.cnblogs.com/ningbj/p/11665846.html