Java Class Library Loading Sequence

Source: Internet
Author: User

The method for loading a library in Java is related to its classloader. Different JVMs have different classloader. This section describes the loading sequence of the built-in JVM of j2sdk.

First, Java loads the jar (ZIP, directory) contained in the parameter according to the system parameter classpath. As long as you use this JVM, you do not need to set classpath. Classes used in the program will be automatically found and loaded here.

When we run java.exe to run a program, we can also add the-classpath (-CP) and the package used. However, these packages will only be valid during this operation and will not affect other programs.

Finally, the program loads class files from the current directory (current package. (Nonsense)

Like tomcat, the second method is used to add additional packages. Therefore, there are two ways to add third-party packages in Tomcat. One is to add the system parameter classpath, and the other is to modify the BAT file.

 

 

 

 

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.