The meanings of various libraries in MyEclipse

Source: Internet
Author: User
Tags java se

the meanings of various libraries in MyEclipse

JRE System Library, Java EE 5 Libraries, referenced Libraries these three are the collection names of various jar packages (library files), which can be arbitrarily taken, just the default name of Eclipse.

JRE System Library: Refers to a collection of common repository files for Java SE, which is used to build common Java projects;Java EE 5 Libraries: Refers to a collection of common library files for Java EE, and the creation of Web projects uses a collection of library files for this library collection and Java SE;referenced Libraries: Refers to the collection of third-party library files that you use in your project. If you add the other jar packages that you need for your project directly to the project---Properties->java Build Path, Libraries, MyEclipse automatically classifies these jar packages into a collection and is named referenced Libraries, which is displayed in the project.referenced libraries is a jar package used in a compiled environment,The so-called jar package used in the compilation environment means that when you write the source files in Eclipse, the classes you need to refer to are taken from the jar packages in the referenced libraries collection .The jar package in Webroot/web-inf/lib is the jar package used in the runtime environment, and the jar package used in the so-called runtime environment is the set of jar packages that you need to use when running your project;
The jars in Java are so important that without them we cannot make such an art program: encapsulation, modularity, multiplexing, and so on (no ant, Marven way). Today, I'm going to tidy up some of the ways to add management to the jar packages in your project and to solve common problems: 1. Jar is imported into our Web project under Classpath 1) Here, one way is, directly with the MyEclipse in the relevant project jar package, right-click on the Project "MyEclipse" menu, select the corresponding jar package is OK, example "ADD Spring capabilities", And can set some of the spring configuration information, good visual operation; 2) Add the external jar package to the Web project's Lib package, right-click the project "Properties"--"Java Build Path"--"Libraries" tab (of course, under this action, Not just the way to add a jar package); 3) Manually copy the jar file to the project Lib package, the specific operation as long as the jar file to be added to the MyEclipse in the workspace of the Lib package is good; At this point, the jar file added is OK, so Easy!jar is added, but these kinds of what difference, how to manage later, next look at the 2nd 2, three kinds of jar package add way, all work, very OK, then how to choose? 1) In this way, the jar file is directly linked to the MyEclipse file, and is not copied to the Web-inf/lib directory, the project may not be published, migrated, the jar can not be found in the case; 2) Selective comparison of strong, can be arbitrarily added jar package, as long as you exist on the machine can be, the link is also the absolute path of the jar file, the disadvantage of 1; 3) Directly added to the Web-inf/lib directory, the portability of strong, and strong operability.  In a word, the 3rd kind of jar package import way, personally think is good!  3. Show/Hide jar files in the project different developers have his own habits, and some people feel that it is too annoying, uncomfortable, and complicated to display the jar package in the development view. And some people, he would like to look at what the use of the technology, what the jar, and by clicking on the jar package in the class file directly view the source code (assuming the previous import source). So, there's a problem with the display and hiding of a jar package: In the Packages Explorer form, there's a drop-down triangle in the upper-right corner, click---"Filters"--"Name filter Patterns (matching names will is hidden) ", under this option, fill in the *.jar, tick the check box to indicate that this type of file is not displayed, multiple types can be", "delimited.  4. In the Eclipse Project Java Build Path setting, you can add a third-party jar package, but I found there are several ways to do this, with "add Jars", "Add Externel jars", "add Library "," Add Classes Loader "and so on, what is the difference between these ways? The Add jar is a means to add a jar from your project, provided that you have placed the jar in your project directory. The add external jar indicates that the location of the jar requires a URI to locate and the full path needs to be given. The add Library is a collection of already defined jars, because they are often used together, so it simplifies operations such as when you do RCP development there is a plugin library that contains the basic plugins needed to run the project. Add Classes Loader--Should this be an Add Class folder? This is a meaning to add a jar, which is to tell ClassLoader where to find class. 5. When the java.lang.ClassNotFoundException appears: Org.springframework.web.context.ContextLoaderListener similar to this can not find listener exception, it is important to remember that the Spring jar package must be placed in the project Lib in order to avoid this error occurs.   add: Although it is the same in any way that importing a package runs locally, there are only Java Build paths that work when I run it, Some can only be imported into the lib. With the Java build path to import the package and copy the package to the Lib there is a difference, it does not conflict, it does not matter, Java build path is the package we need to compile, such as when the import ***.***.*** when the Java build The path imports the package there is a red fork in the class, said that do not recognize the class, import into the Lib is the program to run the package required, even if the Java Build path imported package, not put into the LIB, run the project will appear classnotfoundexception exception.

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.