java--Development and JDK installation

Source: Internet
Author: User
Tags class definition clear screen java se

Software: Program + data

Software Classification:

By Application Range:

System software

Application software

According to whether the charge:

Free software

-Pay Software

By whether Open Source:

Open Source Software

Closed source software

Memory Classification:

Cache: Cache

RAM: Memory, power loss data lost. Non-persistent storage.

Disks: disk, power loss data is not lost, persistent storage.

The data on the disk cannot be used directly by the CPU and must first be loaded into memory.

How to open the cmd window:

1. Start menu, search box->cmd Enter

2. Folder browse the Address bar input cmd, you can directly navigate to the current path

3. On the Notepad++ tab, right-click on "Open Path (folder)"

4.win shortcut + R-cmd Enter

The following three kinds of more commonly used.

Common DOS commands:

Dir:d irectory View all files and folders (directories) under the current path

CD: Switch path: Change directory

You can add an absolute or relative path:

Absolute path: The path starting with the drive letter is the absolute path

Relative path: A path that does not begin with a drive letter is an absolute path

There are two more special references:. Represents the current path ... Represents a reference to a parent directory

Special operations: Switching between the drive characters.

Direct write letter. C: \ D:\

Cls:clear Screen Cleaning

A shorthand for md:mkdir. Make directory: Create a directory

MD a\b\c\d\e\f Cascade Creation

Rd:remove directory: Delete empty directories

/Q: Quiet mode

/s: Cascade Delete

Quick return to root directory: cd \ or CD/

Del: Delete files (do not walk Recycle Bin!!!)

Wildcard characters for file names: globing

?: Represents a single character

*: Represents any character

Exit: Exit.

programming language development:

First generation: Machine code 011110101001

Second generation: assembly language: There are simple abbreviations for English words.

Third generation: High-level language: closer to human natural language.

The more advanced the programming language, the closer the human natural language is.

three architectures for the Java language:

JAVA EE: Enterprise Edition, a set of solutions specifically for web development.

JAVA SE: Standard Edition, you can develop simple desktop applications. It is the foundation of two other architectures.

JAVA ME: Small edition, specifically for mobile devices.

jdk1.5 formerly known as: Java EE, J2SE, J2ME.

Java Virtual MACHINE:JVM

Jdk:java Development Kit: Development Kit

Jre:java Runtime Environment: Runtime environment

Jvm:java Virtual Machine:java is also a software.

The JVM does not run alone and requires the support of the API Core class library.

JDK = JRE + development tools

JRE = JVM + Core class library (API)

As a developer, you only need the JDK.

WINDOWS64-bit operating system, you can install 64-bit and 32-bit JDK.

WINDOWS32-bit operating system, only 32-bit JDK can be installed.

uninstallation of JDK:

Control Panel, uninstall the program, find the JDK installer (two), uninstall each.

installation of the JDK

1. Create a directory dedicated to storing the software

C:\mysoft

2. Double-click the installer

Change the directory to the c:\mysoft you just created, and then create a JDK-related directory below.

C:\mysoft\jdk8

To enter the Setup program:

3. Install JRE during installation, select Install, select Directory with JDK level

Like what:

C:\mysoft\jre8

4. Installation process

5. The installation is complete. Click Close

verifying the installation of the JDK

Enter java-version in any directory

Error message: Command not found:

Reason:

All commands entered in CMD, the system is in the path of the environment variable to look for, found on the execution, can not find the error.

The solution:

Tell the PATH environment variable where the Java command is.

path structure of the JDK's installation package:

Bin:binary. binary files, binary files in Windows refer to executable files (Programs).

DB: The software comes with some important data encryption.

Include: Files that are included, usually header files written in C language.

Jre:jdk comes with the JRE.

Lib: third-party API libraries.

Configuring environment Variables

1. Right-click Computer

2. Click Environment variables

3. Modify the System environment variable path

Take one of the contents to a text file, and at the end add the path to the bin directory in the JDK, separating the paths with a semicolon in English.

For example:

C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\; C:\mysoft\Python34; C:\mysoft\Python34\Scripts; C:\InstallPackage\scala-2.10.3\scala-2.10.3\bin; C:\mysoft\hadoop-2.7.3\bin; C:\mysoft\apache-maven-3.5.2\bin; C:\mysoft\MySQL\MySQL Server 5.5\bin; C:\mysoft\MySQL\bin; C:\mysoft\jdk8\bin

Everyone's computer environment variables are different, can not casually copy other people's environment variables to get directly with!!

4. Re-open a CMD window, enter the Java-version command, the following prompt, indicating that the installation OK

The SET command can view all environment variables for the current system

writing Java code

1. Write the source code, saved in a text file with a. java suffix

2. Compile it with the Javac command:

Javac:

C-Compiler compilation (converts human-identifiable code into binary instructions that can be recognized by the computer)

The result of the compilation is to generate a bytecode file with the same name as the class name: Xxx.class

3. Run the program using the Java command.

Java + class name (XXX)

unhide the file's suffix name

Unhide extensions for known file types

settings for notepadd++:

Preferences, settings

compile and run the first program:

1. Create a folder in the C drive that is designed to hold the code:

C:\code13

Create a folder with a number of days command: DAY01

2. Create a text file in Day01. and renamed: Helloword.java

Write the following code in it:

public class helloworld{

public static void Main (string[] args) {

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

}

}

3. Open cmd under current path

4. Compiling the source file with Javac

Javac Helloworld.java

The result of a normal compilation is: Generate a Helloworld.class

5. Run the binary file

Java HelloWorld

Common errors:

1.path is not configured to cause the command to be found.

2. Case error, resulting in class not found

3. Random Configuration Classpath

The Java command looks for the path to the class

By default, this is the current path.

Attention:

When you open a command prompt window in notepad++, the previous environment variable settings are cached!!!!

notes:

There are three main types:

1. Line comments

Starting at the end of the line is the comment content

2. Block Comment/Multiline comment

/* * * * * * * * * All content will be commented. can span lines.

Note: Multiline comments cannot be nested.

3. Documentation Notes: Future Talk

Two kinds of effects of annotations:

1. Prompt action

2. Help Debug

Keyword: keyword

Java has given special meanings to words that are characterized by lowercase letters.

Key words to see now:

Public: Publicly, openly. Permission modifiers, which describe the classes or methods that can be used.

Class: Defines the classes.

Static: This method can belong to a class and can be called directly using the class name.

void: empty. Indicates that the current method does not have a return value.

Main: Not a keyword. The entry point of a conventional procedure.

a demonstration of how many class definitions a source file can write:

/*

Demo: file names and class names do not necessarily conform

The class name and file name must be consistent if you add public to the front of the class.

Otherwise, the file name and class name can be inconsistent.

At this point, the result of a successful compilation, the name of the bytecode file and the class name are identical.

*/

public class demo4{

There is no public adornment, which indicates that the permission is default (permissions: Package permissions)

If the package is not defined, it indicates that it is in the default package.

Class demo4{

public static void Main (string[] aa) {

System.out.println ("Hello");

}

}

The class that you want to run directly by the JVM virtual machine must contain the main method, otherwise it is not defined.

Class demo5{

public static void Main (string[] aa) {

System.out.println ("Hello");

}

}

Summarize:

In general: Only one class is defined in a source file, and the class is public decorated, and the class name and file name are consistent.

A source file can contain multiple class definitions, but only one of the public adornments. After this source file is compiled, the class generates its own. class bytecode file.

1. The Java application cross-platform principle

Different JVM virtual machines on various platforms


2.JDK,JRE,JVM
The respective meanings, as well as the inclusion relationship?

Jdk:java Development Kit; Jre:java runtime environment; Jvm:java Virtual Machine

Jdk=jre+java Development Tools

jre=jvm+ Core class Library (API)

3. What is the basic process for writing a Java program?

To write a program compiler to run a program
4.
What does the system environment variable path mean?

Path environment variable. The function is to specify a command-search path, which, when executed at the command line, compiles the Java program, and it looks in the path specified by the path variable to see if the appropriate command program can be found. We need to add the bin directory in the JDK installation directory to the existing path variable, the bin directory contains frequently used executable files such as Javac/java/javadoc, and so on, after setting the path variable, you can execute Javac/java and other tools in any directory.
How many comments are there in 5.Java? What are the main uses?

Line Comment://start to the end of the bank is the comment content

Block Comments:/*/* * * * * * * * All content is treated as comments. You can cross lines.

Documentation notes:

Two kinds of effects of annotations:

1. Prompt action

2. Help Debug


6. What is a keyword? What are the key words that are currently encountered? What is the role ?

English words that are given special meaning by the Java language

public static statically, void indicates that the return value is empty, class

Role
7.
can a source file contain more than one class definition? Can I include more than one public-decorated class definition? Yes, no public adornments, default adornments. No, a class that is modified in a program can have only one
8. What are the requirements for classes that you want to be executed directly by the JVM virtual machine? class contains the main function main () method.

java--Development and JDK installation

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.