The Java build path is the package we need to compile, such as when importing ***.***.*** without the Java Build Path import package, the class has a red fork that does not recognize this class, Build Path is simply a reference to the build of a project to a locally stored package and does not copy the package into the project.
Copy to Lib is the package that the program needs to run, even if the package imported by Java Build Path is not put into Lib, the classnotfoundexception exception will occur when running the project.
following content excerpt from: http://s343174147.iteye.com/blog/1986307
In the case of a Java Web project, it was eventually not run through the local JRE, but instead deployed to Web servers such as Tomcat, Weblogic, WebSphere, and so on, all of which implemented their own classloader.
such as the Tomcat application server, it has its own classloader, according to the specifications of the Java%web-project%/web-inf/lib to find the appropriate LIB, which is why we publish the Web application to conform to that format
As an example of the tomcat typical result, its directory structure corresponds to four different classloader, the relationship is as follows:
Common---Commonclassloader
Server---Catalinaclassloader
Shared---Sharedclassloader
WebApps---WebappClassLoader
Our web applications are deployed to the WebApps directory, and the WebappClassLoader loader is specifically responsible for loading class libraries and class files under Web-inf for all Web projects under WebApps. The jar package we introduced through build path is naturally not loaded by the WebappClassLoader loader, so classnotfoundexception will appear.
Eclipse references the library to compile code to generate the class file in the web-inf/classes, and when using the Eclipse Java EE IDE, all lib in the Web-inf/lib is automatically added to the library
The library under Eclipse Engineering is used to compile the Java files inside the SRC
When actually published to Tomcat, only the jar packages inside the web-inf/lib are copied, so eclipse can compile properly, but Tomcat runs without the class being found.
The difference between the build Path import package in Eclipse and the copy to Lib package