In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail the example analysis of adding jar packages to eclipse. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
1. Jar is imported into our web project under classpath
1) here, one way is to directly use the related project jar package included in MyEclipse, right-click the project "MyEclipse" menu, select the corresponding jar package to OK, for example, "Add Spring Capabilities", and you can set some configuration information of Spring. Good visualization operation.
2) add an external jar package to the lib package of the web project, and right-click the project "Properties"-- > "Java Build Path"-- > "Libraries" tab (of course, this is not the only way to add jar packages)
3) manually copy the jar file to the lib package of the project. Just copy the jar file to be added to the lib package under workspace in MyEclipse.
At this point, the addition of the jar file is OK, and the so easyproof jar is added, but what's the difference between these and how to manage them later? let's take a look at point 2.
2. Three ways to add jar packages are all feasible, very OK, so how to choose
1) in this way, the jar file is directly linked to the MyEclipse file, but not copied to the WEB-INF/lib directory, and the project release and migration may not be used. There may be situations where jar can not find it.
2) the selectivity is strong, you can add the jar package at will, as long as it exists on your local machine, the link is also the absolute path of the jar file, the disadvantage is the same as 1
3) add it directly to the WEB-INF/lib directory with strong portability and maneuverability.
All in all, the third) jar package import method, I think it is still good!
3. Show / hide jar files in the project
Different developers have their inherent habits, and some people find it too disturbing, uncomfortable and complicated to display jar packages in the development view. For some people, he just wants to see what technologies have been used, which jar packages have been imported, and view the source code directly by clicking on the class file in the jar package (assuming the source code has been imported previously). So, this involves a jar package show and hide the problem: in the Package Explorer form, the upper right corner of a small drop-down triangle, click-- > "Filters"-- > "Name filter patterns (matching names will be hidden)", fill in this option with * .jar, check the check box means that this type of file does not show, multiple types can be separated by ",".
4. In the Java Build Path setting of the Eclipse project, you can add a third-party jar package, but I found that there are several ways to do this, such as "Add jars", "Add Externel jars", "Add library", "Add Classes Loader" and so on. What's the difference between these ways?
Add jar means to add JAR from your project, as long as you have put jar in your project directory.
Add external jar indicates that the location of the jar needs to be located by URI and the full path needs to be given.
Add library is a collection of defined jar, because they are often used together, so some operations are simplified, for example, when you do RCP development, you will have a plugin library that contains the basic plug-ins needed to run the project.
Add classes Loader-- this must be add class folder, right? This means the same thing as adding jar, which tells ClassLoader where to find class.
5. When an exception like java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener does not find Listener, be sure to put the jar package of spring under the lib of the project in order to avoid this error.
This is the end of this article on "sample analysis of adding jar packages to eclipse". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.