Language and environment for the introduction of Java SE (first article)

Source: Internet
Author: User
Tags java se

Javase's language and development environment
Keke
March 08, 2016

Java belongs to-oracle Corporation (Oracle)
Founder: Gosling
1995 births
December 1998 released jdk1.2
February 2002 Release: jdk1.4
December 2006 Release: jdk1.6
2007 Sun Falls, Google launches Java-based JVM for Android
Acquired by Oracle on April 20, 2009.
July 28, 2011, Oracle released jdk1.7, which introduced the Swtich syntax, Diamond generics, multi-exception snapping, auto-closing resources, and so on.
March 18, 2014, release of the jdk1.8 release, bringing new lambda expressions, and many more new features.


The JDK full name is the Java Se Development Kit, the Java Standard Development Kit, which Sun offers a suite of application development packages for Java development that provides the tools and resources needed to compile and run Java programs, including the Java compiler, Java Runtime Environment and common Java class libraries.
Question: What is the relationship between the JVM and the JRE:
The JRE is the containing JVM. The JVM is the virtual machine running the Java core. While running a Java program does not require a core virtual machine, other class loaders, bytecode validators, and a large number of base class libraries, the JRE includes other environments that run Java programs, in addition to the JVM.


01: Download and install JDK
Oracle has divided Java into three parts of Javase,javaee and Javame, and Javase and Java EE have two development packages for the JDK and Java EE SDK, and in subsequent intermediate classes we learn servlet/ JSP belongs to the category of Java EE.

Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Operating mechanism and JVM of the 02:java program

The Java language is relatively special, the Java language program needs to be compiled, but the compilation process will not generate a specific machine code, but rather a platform-independent bytecode, (that is,. class file), of course, this bytecode is not executable, you must use the Java parser to interpret the execution, Therefore, it can be thought that: the Java language is a compiled language, but also an interpreted language. Java program execution must be compiled (JAVAC) and post-interpretation (Java) two steps,
In the Java language, the Java Virtual machine, the JVM (Java virtutal machines), is responsible for interpreting the execution of bytecode files. A JVM is a virtual machine that can run bytecode files. The JVM on all platforms provides the same programming interface to the compiler.
The JVM is an abstract computer, like the actual computer, which has instruction sets and uses different storage areas, it assigns values to execute instructions, manages data, memory and registers, and so on.

Compiled languages: All need to be compiled before they can be run, it is said that if you write any line of new code may need to recompile, and then run. Note Except for example: Java,c++,c,object-c
Interpreted language: Not required, such as: Javascript/ruby/python

Introduction and description of the 03:JDK path
It is best not to use the space path during installation
After the installation is complete, you can see the following path under the JDK installation path:

Bin This path holds the JDK tool tool commands, commonly used javac and Java commands are placed here already the application monitoring is here, coded transcoding tool and so on.
Db: Change path is the path to install JAVADB.
Include: A specific header file for some platforms.
JRE: The JRE environment required to run the Java program is installed under this path.
Lib: This path holds the JDK tool command actually executes the program, has the Tools.jar,javafx-src.zip,src.zip and so on.


04: Configuration of Environment variables
First step: My Computer right--Property---Advanced system settings




Step Two: System variables-New--java_home-directory of the JDK you installed--c:\program files\java\jdk1.8.0_73


The third step: the system variable---new--classpath, the value is:.; %java_home%\lib;%java_home%\lib\tools.jar
Notice that there is a point ahead.

Fourth step: Select the system variable---path--edit--Add the following code at the end of the Path:%java_home%\bin;%java_home%\jre\bin, note that you must split the semicolon before adding

Fifth step: Open the window---Click Run-enter CMD Open the Command Window---Enter the java-version command


Why to configure environment variables:
Configure the Environment directory for the convenience of directories that do not need to switch executables. Facilitate the execution and control of my program. The environment variable is configured so that the system can help us directly to find the executable file directly according to the parameters of the environment variables. If you configure it automatically matches it out. If I can't find the executable file?
The question of environment variables: What is the difference between a user variable and a system variable:
User variables and system variables are all very different, except that user variables are only useful for the current user. While system variables are useful for all users, in order to reduce the impact of their own modifications to others, the fixed set of user variables to avoid affecting other people. The effect of setting user variables and system variables is the same for the current user. If the configuration of the preference system variable is configured in two places.

05: My first Java program--helloworld.java file, you can build Notepad to modify the file name extension can be
public class helloworld{
public static void Main (string[] args) {
System.out.println ("Hello world ....");
}
}

Javac srcfile such as: Javac Helloworld.java
Java class names such as Java HelloWorld
For example: The result: Hello World

This time we're turning on DOS, like

This time we are looking at e-disk will be more than a Hello.class file,

We compile with Javac and use Java commands to execute

Naming rules for 06:java
The suffix of the Java source file program must be. Java and cannot be a different file suffix name.
Java program source files can be arbitrary, but in one case, if the Java program source code class defines a public class, then the file source filename must be the same as the class name. Because Java program source filenames must be the same as the public class name, a Java source file can only define one public class at most.
Casing is differentiated
The class name must begin with uppercase.
The difference between public class and class
Public is an access modifier that means that any place can be referenced
Class is a keyword that declares a class, such as: Class a{}//declares a class, named a
Class can be modified only by public, and if no public is the default access modifier, the access permission for the default access modifier is: Members within the same package can access the reference
So the public class means: Declare a class that can be referenced anywhere.

08: When to use IDE tools
Editplus,myeclipse,eclipse,netbeans, etc.

Summarize:
Class configuration environment variables, writing Helloworld.java class is mainly to let everyone understand that Java is a first compiled after the implementation of the language. Run in the JVM, in the future Java code to write in our code (meaning: Add properties, modify the characteristics of the method) need to recompile the code to be able to run, and we do not struggle with this stage can understand that Java is based on compiling and running is enough, other understanding can be, Because after all development is impossible to use the command window to develop.

Language and environment for the introduction of Java SE (first 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.