Java Environment Configuration principle detailed 1.JDK installation directory file Description:
- General JDK installation directory and path \java\jdk1.7.0_79\lib, which mainly contains the following folders.
Bin: The main storage is the Java tools commonly used commands such as: Java,javac and so on.
DB: Path to install Java DB.
Include: some platform-specific disease header files.
JRE: The JRE environment required to run the Java program.
The actual location of the LIB:JDK tool command, such as the Javac command in the bin, is actually the Main.class file in Tools.jar\sun\tools\javac in Lib, and the Javac command in the bin simply wraps the class. In fact, most of the commands in the bin are packaged with the tool class in Tool.jar.
Src.zip: The source code that mainly holds the Java Core Class library.
Other documents are mainly descriptive documents.
2.Path Path Settings
Java source code files need to be compiled and interpreted to execute, which requires Javac, Java commands.
The primary purpose of setting path is to allow the system to automatically javac and Java commands in the bin file.
Setup method:
My Computer Right-click-----> Properties-----> Environment Variables
Environment variables include user variables and system variables, user variables mainly refers to the current user operating environment, system variables refers to all users of the environment variable configuration. The difference is that the system will first look for the command that uses the system variable path.
The command line typically looks for a command through the path, because the path to the Java Tool command needs to be added to it.
Direct click New variable name: PATH variable value: \java\jdk1.7.0_79\bin; then OK.
To determine whether the configuration is OK, you can click on the Start menu---------> Run input cmd, enter command line tool, enter Javac to see a series of javac command options. As follows:
3.ClassPath Path Configuration
Before the JDK is required to configure the Classpath path, the JDK after 1.5 is now available without configuration. The purpose of configuring the Classpath path is to allow the Java command tool to know where the. Class bytecode file is.
Path "." The main reason is to tell the JRE to find the. class file in the current file, in addition to the Java classes in the JDK directory under Lib Dt.jar,tool.jar for the compilation run, because they also need to add their paths to classpath.
If the CLASSPATH variable name already exists in the variable environment, add it directly to the value of the variable.; %javahome%\lin\dt.jar;%javahome%\lib\tool.jar where%javahome% represents the installation path of the JDK.
Test is configured to be the same as above in the cmd command line input Java will appear Java help options.
4. Other System Configuration
The above configuration process is mainly on the XP system, the configuration of Linux system can self-Baidu Linux Java environment configuration.
The configuration here is mainly to let you understand the reasons for this configuration and help the novice to quickly set up the Java environment, other detailed configuration and other problem-solving methods can refer to the JDK Help documentation.
Java Environment Configuration principle