Java Knowledge: (1) JRE and JDK

Source: Internet
Author: User

1. The difference between JRE and JDK

The JRE is the Java Runtime environment. Jre=java virtual machines + Core class libraries (Files run by secondary Java virtual machines).

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/1A/wKiom1c3XoaQhAR4AAB6p-ZLGk8493.png "title=" Jre.png "alt=" Wkiom1c3xoaqhar4aab6p-zlgk8493.png "/>

The JDK is a Java development assembly. Jdk=jre+java Development tools.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/17/wKioL1c3X3-gJz0GAACaTYrSXyM337.png "title=" Jdk.png "alt=" Wkiol1c3x3-gjz0gaacatyrsxym337.png "/>

2. installation directory of JDK

The path to installing the JDK should be noted, not with Chinese path or space

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/17/wKioL1c3X5GikFc8AACaTYrSXyM025.png "title=" Jdk.png "alt=" Wkiol1c3x5gikfc8aacatyrsxym025.png "/>

|-JDK installation directory

|-bin: A Java-stored development tool

|-java.exe: Starts the Java Virtual machine, interprets and executes the specified class file. Use the format: "Java-specified class file", such as Java Hello.

|-javac.exe: Starts the Java compiler and compiles the specified Java source text. Use format: "Javac java source Files", such as Javac Hello.java

|-db:jdk7 comes with a lightweight database, named Derby.

|-include: The interface text that holds the calling system resource.

|-jre:java the operating environment.

|-lib: Core Class library.

|-src.zip:java source code.





3. Configuring Java Environment variables

Question: How do I write the file name of an executable file in the console?

Write the file name of an executable file in the console, then the system will first search the current path of the console for the existence of the file, if the specified file can be found, then execute the file, if the file cannot be found, The system also searches for the specified file based on the path information saved by the environment variable of path, and executes the file if it can be found.

3.1. Configure the Java environment variable: path

Question: 1. What is the purpose of configuring the PATH environment variable?

Answer: The console can find Java development tools under any path.

Question: 2, how to configure the environment variable of path?

Answer: My Computer--Properties--Advanced system settings--advanced--environment variable--(System variable) path. Copy the path where the Javac is located to the PATH environment variable.

Instead of configuring the path variable, use the SET command to set the temporary path path: NOTE: Whenever you see the environment variable information set by the SET command, it is a temporary environment variable information.

Use of the SET command
usage meaning
Set View all the environment variable information.
The name of the SET environment variable View the specified environment variable information.
Set environment variable name = path information Sets the specified environment variable information.
Set environment variable name = Empties the specified environment variable information.
Set environment variable name = new Path;% environment variable name% Add new path information based on the original.


3.2. Configure the JAVA environment variable: java_home

Problems that exist:

The current PATH environment variable, in addition to preserving our own configuration of information, there is the system's own information, if you accidentally deleted the PATH environment variable information, it may result in the system part of the function can not be used. Try to avoid modifying the PATH environment variable information.

The purpose of configuring Java_home:

The goal is to avoid frequent changes to the PATH environment variable

Create a new environment variable to save the part of the JDK installation directory that will change, and then reference the information saved by the new environment variable on the PATH environment variable.


3.3. Configure the Java environment variable: classpath

Configure the role of classpath:

When the CLASSPATH environment variable is set, when the JVM (Java Virtual machine) is started, the Java Virtual machine will look for the corresponding class file according to the path information saved by the CLASSPATH environment variable.

Problem: Setting CLASSPATH environment variable information The difference between a semicolon and no semicolon

1. If the configuration classpath environment variable information does not include a semicolon, then the Java Virtual machine will only search for the corresponding class file in the path saved by Classpath, and will not search the current path down.

2. If the CLASSPATH environment variable information is configured with a semicolon, the Java Virtual machine will search for the corresponding class file in addition to the path saved by Classpath, and if it can find the corresponding class file, it will immediately specify the corresponding class file. Otherwise you will go down to the current path to search.



Java Knowledge: (1) JRE and JDK

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.