Dark Horse programmer: Java environment variable

Source: Internet
Author: User

Android training and Java training. We look forward to communicating with you! ----------

Three technical architectures of Java:

Javaee: JAVA Platform Enterprise Edition, which is used to develop applications in the enterprise environment, mainly for Web application development;

Javase: Java platform Standard Edition, which completes the development of desktop applications, is the basis of the other two;

Javame: Java platform Micro Edition, which develops electronic consumption products and embedded devices, such as programs in mobile phones;

1. JDK: Java Development Kit, Java Development and runtime environment, Java development tools and JRE.

2. JRE: Java Runtime Environment, Java program running environment, class library + JVM (Java Virtual Machine) required for Java running ).

3. Configure environment variables: Run tools in the Java JDK \ bin directory in any directory. The reason is that the directory where the tool is located is told to the system, when this tool is used, the system will help us find the specified directory.

Environment Variable Configuration:

1): Permanent configuration: java_home = % installation path % \ Java \ JDK

Path = % java_home % \ bin

2): Temporary configuration: Set Path = % PATH %; C: \ Program Files \ Java \ JDK \ bin

Features: by default, the system first finds the program to be executed in the current path. If not, it finds the program in the path set in path.

Classpath Configuration:

1): Permanent configuration: classpath =.; C: \; E :\

2): Set classpath =.; C: \; E :\

Note: when defining the classpath environment variables, pay attention to the situation

If the environment variable classpath is not defined, after Java starts JVM, it will find the class file to be run in the current directory;

If classpath is specified, the class file to be run is located in the specified directory.

Will it be found in the current directory? Two cases:

1): If a semicolon exists at the end of the classpath value and no running class is found in the specific path, a new class will be found in the current directory by default.

2): If the classpath value does not have a semicolon, the running class is not found in the specific path, and the current directory is not found.

Generally, the semicolon is not specified. If the class file to be run is not found in the specified directory, an error is returned, which allows you to debug the program.

4. What do javac and Java commands do?

Java is divided into two parts: Compilation and running.

Javac: responsible for compiling. When javac is executed, the Java compiler program is started. Compile the. Java file with the specified extension. Generates bytecode files that can be recognized by JVM. That is, the class file, that is, the Java running program.

Java: the part responsible for running. It will start JVM. Load the class library required for running and execute the class file.

To execute a file, there must be a starting point for execution, which is the main function.

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.