Dark Horse Programmer-java Basic knowledge + environment construction and variable configuration

Source: Internet
Author: User
Tags directory create

One, DOS command

Software: A collection of computer data and instructions organized in a specific order.

Interactive mode: graphical interface, command line mode

Dir directory displays files and subdirectories

CD Change directory changes the current path (enter the specified directory)

MD Make directory Create a new subdirectory (folder)

Rd Remove Directory Deletes a subdirectory (folder)

CD: Return to previous folder

cd/return root directory (disk)

Del Delete delete file (do not walk Recycle Bin) del *.txt (delete all txt files in a directory)

ren rename renaming

Attention:

RD Delete a subdirectory (folder) (to ensure that there are no files in the directory, if you have files, directly with the "Rd directory" command, you can execute the DEL command to the directory, and then use the RD command to delete the directory, the advantage is that there is no need to change the path back and forth)

such as: C:\abc\op has a text document 1.txt, to delete the OP folder

Method 1:

Delete text Document first C:\abc\op>del 1.txt

Back to ABC C:\abc\op>cd.

Delete Op c:\abc>rd op

Method 2: Execute the DEL command directly under ABC

C:\abc>del op will then prompt to delete the files in the directory to determine

C:\abc>rd op

Completing the OP directory removal is simpler than Method 1

Ii. Overview of the Java language

1. Java is a language that allows a user to transfer an application over the Internet from a remote server to a local computer and execute it.

Features: Object-oriented, safe and reliable, independent of platform (operating system), portability

Rationale: Installing a Java Virtual Machine JVM on a platform that needs to run Java programs can be done by the JVM to parse the Java run. (Virtual machines are available in different versions depending on the operating system)

2. Three technical architectures of the Java language:

Java EE Enterprise Edition: A Solution for developing applications in an enterprise environment, technical server JSP, etc.

J2SE Standard Edition: is a solution for developing common desktop and morning applications that can be developed for a number of desktop applications.

J2ME Small version: solutions for developing electronic consumer products and embedded devices. The main application is in the mobile app.

Java5.0 after the name of the word Java EE.

Iii. Construction of the environment

Download, install JRE, JDK, configure environment variables.

Jre:java Runtime Environment Java Runtime Environment, including core class libraries required for Java virtual machines and Java

Jdk:java Development Kit Java Development package includes development tools and JRE, development tools Javac.exe, packaging tools Jar.exe, etc.

1. Why does the JDK include the JRE?

One: The development of the program will always run to see the effect;

Second: The development tools for the bin directory under the JDK are written by Java, and the runtime needs to run the support of the environment virtual machine

2. Why to configure the Java environment variable

After installing the JDK, use the command line to enter into Lib and execute the Javac.exe program in Lib.

F:\jdk1.6.0_24\lib>javac, then if you exit into the JDK F:\JDK1.6.0_24\LIB>CD:, the execution of Javac.exe,f:\jdk1.6.0_24>javac at this time is unsuccessful.

Question: Does each development program go to the Lib directory? The requirement is that commands can be executed in any directory.

The answer is: the path of the command tool to tell the system, by the system to find, more convenient use of commands, that is, the Java environment variable configuration.

3. Configuration Tips

Some times will change the JDK's drive letter or name, each change will go to the path to change once, in case of misoperation to other configurations, you can use a configuration technique:

(1) Use a new environment variable A to record the drive letter and file name of the change: java_home=f:\jdk1.6.0_24

(2) Get the value of a in path, plus the unchanged bin Path=%java_home%\bin

Note: The percent sign is the dynamic acquisition of an existing environment variable value, so just change the value of the variable is OK

4. Temporary configuration of environment variables

Use the DOS SET command (to view or set environment variable values)

C:>set path to view the value of path

C:>set Path=haha Setting the value of path

The path value is Haha, but opens a DOS window set path again in the Start menu, or the previous value.

This shows how the environment variable is configured in DOS and is only valid in the current window. However, if you use the Start command to open a DOS window after configuration, this window will inherit the environment variable value from the original window.

In this way configuration, the value of path previously had no, only the newly configured, what if you want to add a new value based on the PATH environment variable value?

You can use dynamic get variable values: C:>set path=haha;%path%

Iv. Composition of Hello world

Keywords: words that are given special meaning by the Java language, such as class keyword specifically defined classes, the keyword can only be lowercase

1. Java Code of notation

A, the class name to have the meaning word, increases the readable sex

B, the class name consists of a single letter, the first letter of each word capitalized

C, curly braces define class name intervals

D, the content of the class should have a sense of step (often try Tab key)

E, all methods are to be ended

2, fixed the main function of public static void main (string[] args) {}, to ensure the independent operation of the class, why?

Because the Java command invokes the virtual machine, the virtual machines use the contents of the Windows lower layer and run the specified class, and the specified function, main, is first found in the class and run. In other words, the virtual machine calls us to specify the main function in the class and executes the code. The main function is the entry of a program to ensure that the class runs independently. Which class is required to write the main function inside.

V. Java Documentation Comments

The Javadoc.exe in the JDK can be extracted from the document annotations in the program into a Web page, which is the description of the program being written.

1. Presentation of document annotations:/** * * is Java-specific

In the note://used in a single line,/* */* * * * * * * */used in multiple lines, multi-line comments cannot have multiple lines of comments, can have single-line comments, these two comments will not be interpreted by the JVM execution

2, the use of annotations: 1, note 2, debugging procedures

When writing a program to develop the habit of frequent comments, the idea of their own through the comments first, in the code to reflect, because the code is only a form of reflection of thought.

When writing a new program:

1, first write comments: A, demand, B, thinking C step

Dark Horse Programmer-java Basic knowledge + environment construction and 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.