Day1 Java Basics

Source: Internet
Author: User

Common DOS commands

Drive letter: Enter the specified drive letter.

dir : Lists the files and folders in the current directory

MD: Creating 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 : Back to top level directory

CD \ : Go back to the root directory

echo "Hello java" >a.txt writing text to the specified file

type a.txt display 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.

Cross-platform platform for important features of Java language

What is a cross-platform (computer system), cross-platform concept is an important concept in software development, that is, do not rely on the operating system, but also do not trust the hardware environment. Applications developed under one operating system can still run under another operating system.

The cross-platform of Java

"Write Once run Anywhere"

Java's cross-platform is relative to other programming languages, and applications written in the Java language can run on different system platforms. General high-level languages if you want to run on a different platform, you need to compile at least a different target code. In Windows compiled C language program, under Linux is not able to run. Of course, the C language program compiled under Linux will not work under Windows. The Java language does not need to be recompiled when it runs on different platforms.

Java Cross-platform principle: Java's cross-platform is implemented through the Java Virtual Machine (JVM).

Java Virtual machine (JVM)

Java Virtual Machine A software simulation of the computer. The Java source program is imagined as our C source program, and the bytecode (. Class) generated by the Java source program is equivalent to the compiled binary executable file of the C source program. The JVM virtual machine is equivalent to a computer system (operating system + hardware environment) and the Java interpreter is CPU.

. exe files run directly under the Windows operating system and are machine code (. exe files) running on the CPU

The. Class bytecode file is run under the JVM virtual machine, and Java bytecode is running on the Java interpreter.

The Java interpreter is equivalent to "CPU" running Java bytecode, but the "CPU" is implemented by software instead of hardware. The Java interpreter is actually an application under a particular platform. As long as the interpreter program under a specific platform is implemented, Java bytecode can be run through the interpreter program on the platform, which is the root of the Java cross-platform. Currently, not all platforms have a corresponding Java interpreter program, which is why Java does not work on all platforms, it can only run in the implementation of the Java Interpreter program platform.

JDK Directory Introduction
    1. Bin directory: A compiler, interpreter, and other tools (executables) that store java.
    2. DB directory: JDK7 comes with a lightweight database named Derby.
    3. Include directory: an interface file that holds the calling system resource.
    4. JRE Directory: Store Java Runtime Environment files.
    5. LIB directory: A class library file that holds java.
    6. Src.zip file: The source code for the class provided by the JDK.

Things to keep in mind when installing a JDK:

    1. 1. do not include Chinese in the installation path.
    2. Do not include spaces in the installation path.
Configuring the PATH environment variable

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, and so on, we want to use these Java development tools from anywhere on the computer when we use them. Then we need to have the path of these tools configured in the system environment variables, when we use, the system can help and we find these commands.

CLASSPATH Environment variables
    1. Classpath function: The role is to specify the class search path, to use the already written classes, the premise is to be able to find them, once the Classpath path information is configured, the JVM and the Java compiler will be based on classpath specified path to find the class file.
    2. How to set the current directory (.)

Set classpath=.; Sets the path and set classpath= setting 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; will be found under the current directory.

Day1 Java Basics

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.