Web-info/lib & Build Path's jar package problem

Source: Internet
Author: User

First, build Path&web-info/lib introduction

Build path: Can be said to be a reference;
Web-info/lib: Can be said to be fixed in a place;
Eclipse compiles the project according to build path, if you do not use Eclipse to publish the project, there will be no Jar,tomcat run project is found in its own public Lib to find the jar, if not found, will go to the project web-info/ Lib directory to find, if not found on the error.

The jar referenced by build path can refer to the jar under LIB, or it can refer to any jar on the hard disk where it can be accessed, but I recommend putting the required jar under Lib so that if there is a jar collision and a missing problem, we can go directly to Lib to view it. If you put it in another location, it's relatively cumbersome to check.

It is also a good habit to put it under LIB, referencing the jar in other locations "usually some classmates like to use myeclipse automatically add to struts, Spring, hibernate support", in this way, it is easy to cause jar package conflict, missing problems, Especially in the case of teamwork, if you refer to a jar on your local hard disk, submit a. classpath file to SVN, and when someone checks it out, it will report an error because the jar is not in the same location on his hard drive, and if you put it under Lib, After checking out his lib has this jar, because Lib is part of the project.

Second, copy the project, error

Because Eclipse writes the configuration of build path to the project's. classpath file, the Add extenrnal Jar introduces the jar package to the project, and the. classpath file will be updated so that it doesn't get an error.
Sometimes the jar is copied directly into the project's Web-inf/lib folder and the project is refreshed, and Eclipse automatically references the jar in the build path.
If the jar does not delete the reference in the build path, but instead directly deletes or moves the jar to another location, the refresh project will have an error, and the reference should be removed from the build path. (Import jar package can be imported from this)

You have to first make sure that you are compiling the environment error, or the program error.
Because only the packages in the Web-inf/lib are known in the program. But the compilation environment is not, if the compilation environment in the configuration said somewhere there is a package that it wants, then if that place does not, will also prompt the warning message.
If you want to work in a program, the final package is placed in Web-inf/lib, regardless of where it comes from.
It is recommended to understand the composition of the package in the application, if you rely too much on the IDE, many basic concepts will not understand.

Web-info/lib & Build Path's jar package problem

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.