Detailed explanation of Java environment configuration principle
1.Jdk installation directory file description:
The general jdk installation directory and path /Java/jdk1.7.0_79/lib mainly contains the following folders.
bin: It mainly stores commonly used commands in Java tools such as: java, javac, etc.
db: The path to install java db.
include: Header files for some platform diseases.
jre: The jre environment required to run a java program.
lib: The actual storage location of the jdk tool command, such as: the javac command in bin, is actually the Main.class file in tools.jar/sun/tools/javac in lib, while the javac command in bin just wraps this class. In fact, most of the commands in bin wrap the tool class in tool.jar.
src.zip: Mainly store the source code of the java core class library.
Other documents are mainly explanatory documents.
2.Path path settings
The java source code file needs to be compiled and interpreted before it can be executed, which requires javac and java commands.
The main purpose of setting Path is to enable the system to automatically bin the javac and java commands in the file.
Setting method:
Right click on my computer ------>Properties -------->Environment Variables
The environment variable contains user variables and system variables. The user variable mainly refers to the current user operating environment, and the system variable refers to the environment variable configuration of all users. The main difference is that the system will prioritize finding commands using the system variable path.
The command line generally uses the path path to find commands, because the path where the java tool commands are located needs to be added to the path.
Directly click on the new variable name: path Variable value: /Java/jdk1.7.0_79/bin; then confirm.
To determine whether the configuration is complete, you can click the Start menu ---------->Run input cmd, enter the command line tool, enter javac and see a series of javac command options. as follows:
3.ClassPath path configuration
Before jdk, you need to configure the classpath path, but now you can do without configuring jdk after 1.5. The purpose of configuring the classpath path is to enable the java command tool to know where the .class bytecode file is.
The path "." mainly tells jre to find the .class file in the current file. In addition, the java classes in dt.jar and tools.jar in the lib in the jdk directory are also required, because their paths need to be added to the classpath.
If the classpath variable name already exists in the variable environment, add it directly to the variable value.;%JAVAHOME%/lin/dt.jar;%JAVAHOME%/lib/tool.jar where %JAVAHOME% represents the installation path of jdk.
If you test whether the configuration is good, you can enter java on the cmd command line like above and the Java help option will appear.
4. Other system configurations
The above configuration process is mainly aimed at the XP system. The configuration of the Linux system can be configured on Baidu Linux Java environment.
The configuration here is mainly to let everyone understand the reasons for this configuration and help beginners quickly build a Java operating environment. For other detailed configurations and other problems, please refer to the jdk help document.
The above comprehensive analysis of the Java environment configuration principle is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.