The difference between web app libraries and referenced libraries in eclipse project

Referencedlibraries is a jar package used in the compilation environment,
the so-called jar package used in the compilation environment means that when you write source files in eclipse, all the classes you need to refer to are taken from the jar package in the collection of referencedlibraries
/the jar package in Web inf/lib is the jar package used in the runtime environment. The so-called jar package used in the runtime environment is the collection of jar packages that you need to use when running your project

When I checked online, I said that the jar package under referenced libraries would not be packaged when the project was released. How could the project still run if it could not be packaged

1. Look at your runtime environment. There are some jars in the runtime environment, such as Tomcat’s own jars (such as servlet API)
2. There are some project management tools (such as maven, etc.) that will put all the packages you depend on into the war package. Please refer to the blog “what should be noticed when packaging Maven projects”
3. Some ide plug-ins are more intelligent. If the configuration is appropriate, the debugging runtime will automatically point to your compile time environment. Refer to the blog “developing a Jee project using eclipse’s maven2 plug-in”

Add referenced libraries:

Create a new lib folder under the project and put the jar in it. At this time, you just copy the jar package into the project and cannot use it. Then, right-click on the project name and select build path — & gt【 In the open window, first select the [libraries] page, and then click [add jars…] from the button on the right

Add web app libraries:

Put gson-2.2.4.jar package in webcontent – > WEB-INF-> Lib, it will be automatically compiled into the web app library

Similar Posts: