1.1. Common dos commands
Drive Letter: Enter the specified drive letter.
dir : lists the files and folders in the current directory
MD: Create a directory
Rd : Delete directory Note:Rd cannot delete non-empty folders, and can only be used to delete folders.
CD : Enter the specified directory
CD : go back to the top level directory
CD \ : go back to the root directory
echo "Hello java" >a.txt writing text to a specified file
type A.txt Show file Contents command
del : Delete file Note: You cannot delete a folder, only files can be deleted.
exit : launch dos command line
CLS : notifies the computer to empty the current command
*: is a wildcard character.
Tab command completion.
The arrow keys are up and down to retrieve the last command you wrote.
1.2Javathe three main platforms
Javase
Java SE(Java Platform,Standard Edition). Java SEformerly known asJ2SE. It allows the development and deployment ofDesktop,Server, embedded environments, and real-time environments.JavaApplication. Java SEincludes support forJava Webservice to develop the class, and forJava Platform,Enterprise Edition(Java EE) provides the basis.
Example: SimilarQq, mine clearance, flying autumn, Lingbo and so on desktop applications.
Java EE
Java EE(Java Platform,Enterprise Edition). This version was formerly known asJ2ee. Enterprise Edition helps develop and deploy portable, robust, scalable, and secure server-sideJavaapplication. Java EEis inJava SEbuilt on the basis of this, it providesWebServices,Component Model, management and communicationsApi, can be used to achieve enterprise-class service-orientedSystem Structure(service-oriented Architecture,SOA) andWEB 2.0application.
Java ME
java me ( java Platform micro Edition ) j2me k-java Java ME pda , TV STB and printers provide a robust and flexible environment. The Java ME dynamic rich support for downloadable networking and offline applications. Applications based on the Java ME specification are written once, can be used for many devices, and can take advantage of the native capabilities of each device.
installation of 1.3JDK
Website:http://www.oracle.com/index.html ,http://www.java.sun.com
3.5 Configuring The path environment variable
Problem: currently under the console window can only be used in the JDK directory of the directory to use the JDK Development tools under control, What should you do if you want to use javac and java or Other JDK development tools under any directory under the console window?
1. On the dos window, hit javac .
When we hit Javac or java commands in a random directory , we found that the dos window showed this was not an internal command, and then we knocked on it. Notepad command, a notepad program is opened, but the page does not exist in the current directory notepad.exe executable file, then why do I start it?
error Reason: when you write a command on a DOS window, if the specified executable is not found in the current directory, it will be based on the path environment variable Save the path to search for the existence of the executable file, if it exists, start the program, otherwise there is no such command.
2. Workaround:
1. Enter The bin directory of the JDK 's installation directory .
2, on the dos command to knock javac. ( If the above diagram information is present, the configuration is successful )
3. Why to configure the path environment variable
because there are a lot of tools in the Bin folder under The JDK that we want to use in development, such as java.exe,javac.exe,jar.ex , etc. , then we want to use these Java Development tools from anywhere in the computer when we use them, so we need to configure the path of these tools into the environment variables of the system, and when we use them, The system can help and we find these commands.
4. How to configure the path environment variable
we copy the path to the bottom bin of the JDK
in our computer -----à attribute -----à advanced -----à environment variable ---------Àpath this
Place the path of the bin to the front of the path, and don't forget to add a semicolon .
5.java_home Configuration of the environment
There may be times when you need to change the directory of the JDK , but changing the value of the path often may inadvertently modify the other path, the workaround:
1. Create a java_home variable.
2. the value of Java_home is the installation directory of the JDK.
3. Configure Path path:%java_home%/bin.
need to be replaced later JDK directory, you only need to change the java_home directory.
Set Temporary variables:
Set : View all the environment variable information.
Set Variable name : View the value of a specific environment variable.
Set variable Name =: Clears the value of an environment variable.
Set variable name = Specific value : Defines the specific value for the specified variable.
Want to add a new value based on the original environment variable value?
First, the value of the original environment variable is obtained by the% variable name% operator.
Then add the new value and define it to the variable name.
Example: Adding a new value to the PATH environment variable
Set Path= New Value ;%path%
Note: This configuration only works in the current DOS window. The window closes and the configuration disappears.
4.3 classpath environment Variables
- Classpath function : The role is to specify the class search path, to use the already written classes, if you can certainly find them, once the classpath path information is configured, Both the JVM and The Java compiler look for a class based on The path specified by the classpath file.
- How to set the current directory (. )
Set classpath=.; set the path and Set Classpath= Set Path ;. What's the difference? ?
“.” in the preceding time,the Java virtual opportunity to find the class file from the current path , and then to the specified path to be found. If the "." later,the Java virtual machine looks for the specified path and then finds it in the current path.
When setting the classpath, add ; it will look in the current directory
Day01-java Development Prelude