Ext: Java Two JRE directory and three Lib directory

Source: Internet
Author: User

The jar package is placed in the

 lib directory. The import statement in the program is looking for these files! For example: Import Javax.servlet.RequestDispatcher; The problem with the
     is that in cmd mode, the system prompts: Checkaccount.java:5: Package javax.servlet does not exist!

     After installing the JDK, take a closer look at the folder under the installation path, A total of two contains the JRE directory! There are three LIB directories! Package contains javax.servlet jar packages should be placed in one place. First, under the Tomcat installation directory, locate Servlet-api.jar (located in D:\Program files\apache software foundation\tomcat 6.0\lib\servlet-api.jar). This pack winrar unzip to see the internal structure:
        javax\servlet\http
    &NBSP:
The structure of the import statement is the same!

     My drive, the Lib folder is in the following location:
        d:\ Program Files\java\jdk1.6.0_02\jre\lib
        d:\program Files\Java\ Jre1.6.0_02\lib
        d:\program files\java\jdk1.6.0_02\lib
     under the JDK under the LIB;JRE under the LIB;JDK under the JRE under the Lib.

     verified, the Servlet-api.jar package copy into the JDK under the JRE under the EXT directory, the import statement passed the compilation! namely: c:\program files\java\jdk1.5.0_08\jre\lib\ext related , other externally imported jar packages are placed in this directory. For example: Importing the MySQL driver jar "Mysql-connector-java-3.0.17-ga-bin.jar" in the project, essentially copying the jar package to the EXT directory. In other cases, the addition of the Oracle driver jar package is also handled similarly.

to explain why there are two JRE directories? What are the functions of the three LIB directories?
    
after installing the JDK, there are JDK and JRE two folders in the Java directory, but there is a JRE folder , and this JRE has more server folders than the previous JRE in the bin directory!
     ordinary users to install the JRE. The developer needs to install the JDK, which includes the JRE. So the JRE directory is included in the JDK directory. The two JRE is roughly the same, with subtle differences.
     Two sets of JRE are for different job responsibilities! Different JRE is responsible for the contents of the respective scopes.
     when the user only needs to execute the Java program, then C:\Program Files\java\jre1.5.0_08 's The JRE is OK!
     when the user is a Java programmer, the Java development environment is required. At compile time, the system will take precedence to find the "Java, Javac" directories under C:\Program Files\java\jdk1.5.0_08\bin or the JRE of their parent directory. That is, the JRE under the JDK is running under the development environment.

Again, three Lib directories:
the Lib under the JDK includes the jar package for the Java development environment, which is for the JDK, such as some tools under the JDK that might be used for files in that directory. For example, compilers, and so on.
Lib under the JRE is just a jar package that runs Java programs and is used for the JVM runtime. Includes all the standard class libraries, and extension classes.
The Lib under the JRE under the JDK is the jar package required by the runtime in the development environment. The most typical is the imported external drive jar package. Because at compile time, the system is looking for the JRE under the JDK. Instead of the outermost JRE.

Ext: Java Two JRE directory and three Lib directory

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.