Java Learning Note (i)--01--java overview

Source: Internet
Author: User

1. Command line mode

(1) Open DOS window mode:  
A: Start-run-enter CMD carriage return  
B: Shortcut key WinDOS icon keyboard +r-input cmd enter  
(2) Common DOS command  
A: drive letter switch  
Drive letter: then enter  
B: Lists the files in the current directory and the folder  
Dir then enter  
C: Create directory (folder) learn about  
MD Directory name  
D: Delete directory to understand  
Rd directory name  
E: Enter the specified directory  
Single-level directory  
CD directory name  
Multilevel directory  
CD multilevel directory name,   between directories,
F: Fallback to the specified directory  
Single-level directory  
CD.  
Multilevel directory  
cd\ 
G: Delete file  
del file name  
del *.txt Delete all files ending in. txt  < br> h: Clear screen  
cls 
I: Exit  
Exit

2. The roles and connections of the JVM, JRE, and JDK

JVM: Guarantees the cross-platform nature of the Java language, but the JVM is not cross-platform.
Jre:java the operating environment of the program, including the JVM and core class libraries.
The development environment of the Jdk:java program, which includes the JRE and development tools (installing the JDK is not required to install the JRE, but if you want to simply get a Java program running environment, you can also install a single JRE).

3. Configuration of PATH environment variable

In order for the Javac command to run in any directory, we need to configure the PATH environment variable. (assuming Jak's installation directory is D:\develop\Java\jdk1.7.0_72)

A: Way 1 (recommended)
Create a new variable name:
Variable name: java_home
Variable Value: D:\develop\Java\jdk1.7.0_72
To modify the PATH variable:
You can refer to Java_home by percent.
%java_home%\bin; the previous path content
Equivalent to the following:
D:\develop\Java\jdk1.7.0_72\bin; the previous path content

b: Mode 2 
configures the bin directory of the JDK to path.  
Modify the PATH environment variable in the System properties:  
D:\develop\Java\jdk1.7.0_72\bin; previous path content

C: Environment variable temporary configuration mode:
Sometimes we want to run a program on someone's computer, but it's inconvenient to change other people's environment variables, then we can use the temporary environment configuration.
How to: Open the DOS Command box and enter "set" at the command prompt to view environment variable settings. To see the settings for a specific environment variable, such as to see the settings for the PATH environment variable, you can enter "set path". To create an environment variable, such as to create an environment variable named AA with a value of "C:", you can enter the "Set aa=c:" Command. To delete an environment variable, such as to remove the AA environment variable, you can enter the "set aa=" command (note that there can be no space behind it). How do I change the settings of an environment variable? There are two scenarios for changing an environment variable: One is the Append method, that is, to increase the value of the variable without changing the existing settings of the environment variable, such as to add a setting of "D:" to the environment variable AA, you can enter "set aa=%path%;D:". The other is a completely modified way, for this way, we can adopt the method of directly creating an environment variable to implement.
After the last environment variable is configured, you can run the Javac and java-version commands under CMD to test whether the installation is successful, and if there is any Java related information, it will indicate that the configuration is correct.

4. My first Java program HelloWorld

Create a Helloworld.java file under F:\my file\workspace with Windows Notepad and write the code

public class helloworld{public static void Main (string[] args) {System.out.println ("Hello world!"); } }

Open the DOS command box,

Enter in the following sequence:

C:\USERS\SHENGJIE>F:F:\>CD F:\my file\workspacef:\my File\workspace>javac helloworld.javaf:\my file\ Workspace>java Helloworldhello world! F:\my file\workspace>



This article is from the "12764079" blog, please be sure to keep this source http://12774079.blog.51cto.com/12764079/1912202

Java Learning Note (i)--01--java overview

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.