Javase Basic Summary 1--java overview, JDK installation, environment variable configuration

Source: Internet
Author: User
Tags java format

Javase Basic Point A Java overview What is Java?

Java is a programming language that talks about computer language before speaking the Java language. Computer language is the language of communication between man and computer, which consists mainly of some instructions, such as numbers, symbols and grammars, which can be used by people to command computers for various tasks .

There are many classifications of computer languages, which are divided into three categories: machine language , Assembly language and high-level language . Computers can recognize only machine language, machine language is composed of 0, 1, indicating the opening and closing of signals. Also called binary. Because of the inconvenience to human memory and recognition, the current general programming language is assembly language and high-level languages. Assembly language uses the English abbreviation identifier, easy to identify and remember, and the high-level language is close to human natural language programming, further simplifying the process of program writing, so the high-level language is the majority of programmers currently adopted language.

The Java language is a high-level computer language that was introduced in May 1995 by Sun, a fully object-oriented programming language that can write cross-platform application software. The Java language is easy-to-use, safe and reliable, primarily for Internet programming, and its associated technologies and applications have evolved very quickly. Java technology is ubiquitous in areas such as computers, mobile phones, and household appliances. To enable software developers, service providers, and device manufacturers to develop for specific markets, Sun has divided Java into three technology platforms, Javase, Java EE, and Javame.

Javase Standard Edition

is a solution for developing common desktop and business applications. Javase is the most central part of the three platforms, Java EE and Javame are developed from Javase, and the Javase platform includes Java's core class libraries, such as collections, IO, database connections, and network programming.

Java EE Enterprise Edition

is a solution for developing enterprise-class applications. Java EE can be seen as a technology platform for developing, assembling, and deploying enterprise-class applications, including Servlets, JSPs, JavaBean, JDBC, EJBs, WebService, and more.

Javame Mini Version

It is a solution for the development of electronic consumer products and embedded devices. Javame is mainly used for the development of software programs on small digital electronic devices. For example, add intelligent control and networking capabilities to home appliances, adding new game and Address Book management capabilities to your phone. In addition, Javame provides advanced Internet protocols such as HTTP, which enable mobile phones to access all of the Internet's information in a client/server manner, providing the most efficient wireless communication.

Features of the Java language 1. Simple

The Java language is a relatively simple programming language that can be used to write applications that are appropriate for a variety of situations by providing the most basic way to accomplish a given task by understanding some basic concepts. Java discards the ambiguous concepts of operator overloading, multiple inheritance, and so on that are difficult to understand in C + +. In particular, the Java language uses references instead of pointers , and provides an automated garbage collection mechanism that allows programmers to worry about memory management.

2. Object-oriented

The Java language provides primitives such as classes, interfaces, and inheritance, and for simplicity only supports single inheritance between classes, but supports multiple inheritance between interfaces, and supports the implementation mechanism between interfaces (the keyword is implements). The Java language fully supports dynamic binding and the C + + language uses dynamic binding only for virtual functions. In short, the Java language is a purely object-oriented programming language.

3. Security

The Java language does not support pointers, and all access to memory must be implemented through the object's instance variables, making the application more secure.

4. Cross-platform

Programs written in the Java language can run on a variety of platforms, meaning that the same program can run on both the Windows operating system and the Linux operating system. Its principle is that the Java program's file class is not directly interpreted by the computer to execute, but first run on the Java Virtual machine, through the virtual machine and the system to do an intermediate conversion. Need to understand the Java program cross-platform, but the virtual machine is not cross-platform, want to run Java program on an operating system, it will be installed in the corresponding version of the system version of the virtual machine, Java program-Virtual machine-operating system relationship I drew the following picture for understanding.

5. Support Multithreading

The Java language supports multithreading. Multithreading can be understood as multiple tasks in a program can be executed concurrently, which can greatly improve the execution efficiency of the program.

What is JDK use for JDK?

Sun provides a Java development environment, called JDK, which is the core of the entire Java, including Java compilers, Java runtime tools, Java document generation Tools, Java packaging Tools, and so on.

In order to meet the changing needs of users, the JDK version is also constantly upgrading. In 1995, Java was born at the beginning of the earliest version of JDK1.0, followed by the introduction of JDK1.1, JDk1.2, JDK1.3, JDK1.4, JDK5.0, JDK6.0, JDK7.0, JDK8.0

In addition to providing the JDK, Sun provides a JRE tool, which is a Java runtime environment that is available to ordinary users. Because users only need to run pre-written programs and do not need to write their own programs, the JRE tool contains only Java run tools, not Java compilation tools. It is worth mentioning that, for ease of use, sun has brought a JRE tool in its JDK tool, which means that the development environment contains a running environment, so that developers only need to install the JDK on the computer, do not need to specifically install the JRE tool.

Installing the JDK

The first step is to download the JDK; Open the Oracle company Java download page http://www.oracle.com/technetwork/java/javase/downloads/index.html

The second step is to select the JDK8 version, or you can choose a different version to see a person's preference.

The third step, choose the JDK version corresponding to the system, my is windows32 bit, so choose winx86 version, x86 is 32 bit meaning. If you are afraid to download the wrong 64-bit can also download 32-bit, because backward-compatible.

Once the download is complete, double-click the installation package and follow the prompts next, as My computer is already installed javase here. Say a few points of installation to pay attention to the place, the 1th installation path is best not to have Chinese, easy to lead to inexplicable errors, you also ruled out with what configuration error. 2nd when the installation starts again after the next window, you notice that the system default installation path is the JRE folder, in fact, at this time the JDK has been installed, this is to install a separate JRE. Because the JRE is installed by default when we install the JDK, it is OK to cancel it directly, if you want to install a separate JRE, you can continue the installation. Here the JDK has been installed.

Check that the JDK installation is correct

Install the JDK to run to see if the JDK was installed successfully.

Step: 1, open the command line, the path switch to the Java installation path in the bin directory. Run the Javac command to install successfully if the content appears.

If an internal or external command is not available, a program or batch file that is not running, fails to install, check that the path entered is correct, and that the downloaded installation package is complete and installed correctly.

JDK Directory Introduction

Bin directory: This directory is used to store executable programs such as Javac.exe (Java compiler), Java.exe (Java Runtime Tool), Jre.exe (Packaging tool), Javadoc.exe (document Generation tool), and so on.

DB directory: The DB directory is a small database. Starting with JDK6.0, Java introduces a new member JAVADB, which is a pure Java implementation, open source database management system. This database is not only very light, but also supports JDBC4.0 all specifications, when learning jdbc, do not need to install a database software, select the direct use of javadb.

JRE directory: The JRE is the Java Program Runtime Environment, which is the root directory of the Java Runtime Environment, which contains the Java virtual machine, the runtime's class package, the Java Application Launcher, and a bin directory, but does not include the development tools in the environment.

Include directory: Because the JDK is implemented through C and C + +, you need to introduce some C-language header files at startup, which is used to store these header files.

Lib directory: Lib is the abbreviation for the library, meaning the Java class Library or library file, which is the archive package file used by the development tool.

Src.zip file: The source code for the JDK core class is stored, which allows you to view the source code of the Java base class.

Explain Javac and Java commands in detail.

Javac.exe is a Java compiler tool that compiles well-written Java files into a class byte-code file. The bytecode file is the Java executable file.

Java.exe is a Java runtime tool that launches a Java Virtual machine (JVM) process, which is the equivalent of a virtual operating system that is specifically responsible for running bytecode files generated by the Java compiler.

The first Java program

Create a text document in the bin directory in the JDK installation directory and rename it to Helloworld.java. Then open it in Notepad and write a piece of Java code.

First HelloWorld Program
1  Public class helloworld{2     Public Static void Main (string[] args) {3          System.out.println ("HelloWorld");     4 }     5 }

The above code implements a Java program, the following code in which is a simple explanation of the I system.

Class is a keyword that is used to define a class. In Java, a class is the equivalent of a program, public declares that it is a public class, and the class name of the common class must be the same as the file name. All the code needs to be written in the class. HelloWorld is the name of the class, abbreviated to the class name. Class keywords need to be separated by any white space characters, such as spaces, tabs, line breaks, and so on. The class name is followed by a pair of curly braces, which define the scope of the current class, and all the code needs to be written in this curly brace.

public static void Main (string[] args) {} defines a Main method, which is the execution gate of the Java program at execution time.

An output statement System.out.println () is written in the main method, which is used to print a piece of text information and output it in a command-line window. So that we can intuitively see the results of the program running.

When writing a program to pay attention to Chinese and English problems, all the symbols must be in English half-width format, or compile will be error.

File not found at compile time

It is possible that your file name is wrong, if the file name is correct, the path is also correct, it is likely that you set the hidden file type extension, this time although you named the text document for. Java format, is actually xxxxx.java.txt open the Computer Selection Tool Select folder option in the Advanced Settings bar will " Hide the extensions for known file types option before the Yes cancel and then OK on the line. In the back file view type. If it is txt, rename it to. java format.

System Environment variables

The purpose of configuring environment variables is to facilitate the development, after all, all the programs are placed in the bin directory is not conducive to management. And it is easy to accidentally delete files in Java. The environment variables are configured so that you can run commands in Java under any path.

Step: Copy the Java installation path to the bin first. Then mouse over the computer icon right-click on the Select Properties, select Advanced System settings Select environment variable, in the following system variable found PATH environment variable, double-click Open. Be careful not to move any values inside. In the value of the variable, move the cursor to the front and paste it, and append the semicolon to the pasted path bin. Make sure you save.

We can also configure the classpath to be able to execute. class files under any path.

Step: Or find the environment variable in the above user variable, select New, named Classpath, and then copy the path of the. class file directory into the variable value, followed by an English semicolon.

Exercise questions in the blanks
    1. Java's three technology platforms are (javame), (javase), (Javaee), respectively.
    2. The Java program's operating environment is simply called (JRE).
    3. Compiling a Java program requires the use of the (javac) command.
    4. Javac.exe and Java.exe Two executables are stored in the (bin) directory of the JDK installation directory.

5. The (path) environment variable is used to store the path where Java compiles and runs the tool, while the (classpath) environment variable is used to save the. class file path run by the Java Virtual Confidential.

Select question

Which of the following options are part of the JDK tool? (multiple selection) (ABCD);

    • A:java compiler
    • B:java Running Tools
    • C:java Document Generation Tool
    • D:java Packaging Tools

Which of the following languages does Java belong to? (C);

    • A: Machine language
    • B: assembly language
    • C: Advanced language
    • D: None of the above is correct

Which of the following types of files can be run in a Java virtual machine? (D);

    • A:.java
    • B:.jre
    • C:.exe
    • D:.class

After installing the JDK, there are many EXE executables in its bin directory, which of the following is the function of the "Java.exe" command? (D);

    • A:java Document Authoring Tools
    • B:java Interpreter
    • C:java compiler
    • D:java Starter

If the JDK's installation path is "D:\JDK", if you want to use the Javac and Java commands directly under any current path in the command window, which of the following options do you need to set the environment variable path to? (B);

    • A:D:\JDK;
    • B:d:\jdk\bin;
    • C:d:\jre\bin;
    • D:d:\jre;
Ask questions
    • Describe the characteristics of Java.

Security: The Java language discards pointers in the C + + language, making the program more secure and reliable.

Easy to learn: the same comparison of C + +, no pointers, no multi-level overloading, there is an automatic garbage collection mechanism.

Cross-platform: Compile once, run in multiple places. Java uses virtual machine capabilities to achieve cross-platform performance that other languages do not.

Multithreading: Support multi-threading, so that the operation of the program greatly improved.

Fully Object-oriented: Java is a fully object-oriented language.

    • Describes the differences between JRE and JDK.

The JRE is the Java Runtime Environment, which includes the core classes of Java and the virtual machines, as well as some of the elements required to run Java programs. The JDK is a Java development environment that includes not only the JRE itself, but also the ability to develop Java programs.

Programming questions
    • Write HelloWorld programs independently.
1  Public class helloworld{2      Public Static void Main (string[] args) {3         System.out.println ("HelloWorld"); 4 }5 }

Javase Basic Summary 1--java overview, JDK installation, environment variable configuration

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.